Home Reference Source
import Client from '@fnndsc/chrisstoreapi'
public class | source

Client

API client object.

Static Method Summary

Static Public Methods
public static

createUser(usersUrl: string, username: string, password: string, email: string, timeout: number): Object

Create a new user account.

public static

getAuthToken(authUrl: string, username: string, password: string, timeout: number): Object

Fetch a user's login authorization token from the REST API.

public static

runAsyncTask(taskGenerator: function*())

Helper method to run an asynchronous task defined by a task generator function.

Constructor Summary

Public Constructor
public

constructor(url: string, auth: Object)

Constructor

Member Summary

Public Members
public
public
public
public
public
public
public
public
public

Method Summary

Public Methods
public

createPipeline(data: Object, timeout: number): Object

Create a new pipeline resource through the REST API.

public

createPlugin(data: Object, uploadFileObj: Object, timeout: number): Object

Create a new plugin resource through the REST API.

public

createPluginCollaborator(pluginMetaId: number, data: Object, timeout: number): Object

Create a new plugin collaborator resource through the REST API.

public

createPluginStar(data: Object, timeout: number): Object

Create a new plugin star resource through the REST API.

public

Fetch a list of authenticated user's collaborated plugin metas from the REST API.

public

Fetch a list of authenticated user's favorite plugin metas from the REST API.

public

getPipeline(id: number, timeout: number): Object

Get a pipeline resource object given its id.

public

getPipelines(searchParams: Object, timeout: number): Object

Get a paginated list of pipeline data (descriptors) given query search parameters.

public

getPlugin(id: number, timeout: number): Object

Get a plugin resource object given its id.

public

getPluginMeta(id: number, timeout: number): Object

Get a plugin meta resource object given its id.

public

getPluginMetas(searchParams: Object, timeout: number): Object

Get a paginated list of plugin metas from the REST API given query search parameters.

public

getPluginStar(id: number, timeout: number): Object

Get an authenticated-user-specific plugin star resource object given its id.

public

getPluginStars(searchParams: Object, timeout: number): Object

Get a paginated list of authenticated-user-specific plugin star data (descriptors) given query search parameters.

public

getPlugins(searchParams: Object, timeout: number): Object

Get a paginated list of plugin data (descriptors) given query search parameters.

public

getUser(timeout: number): Object

Get a user resource object for the currently authenticated user.

public

setUrls(timeout: number): Object

Set the urls of the high level API resources.

Private Methods
private

_fetchRes(resUrlProp: string, ResClass: string, searchParams: Object, timeout: number): Object

Internal method to fetch a high level resource through the REST API.

Static Public Methods

public static createUser(usersUrl: string, username: string, password: string, email: string, timeout: number): Object source

Create a new user account.

Params:

NameTypeAttributeDescription
usersUrl string

url of the user accounts service

username string

username

password string

password

email string

user email

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a User object

public static getAuthToken(authUrl: string, username: string, password: string, timeout: number): Object source

Fetch a user's login authorization token from the REST API.

Params:

NameTypeAttributeDescription
authUrl string

url of the authorization service

username string

username

password string

password

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a string value

public static runAsyncTask(taskGenerator: function*()) source

Helper method to run an asynchronous task defined by a task generator function.

Params:

NameTypeAttributeDescription
taskGenerator function*()

generator function

Public Constructors

public constructor(url: string, auth: Object) source

Constructor

Params:

NameTypeAttributeDescription
url string

url of the ChRIS store service

auth Object
  • optional
  • default: null

authentication object

auth.token string
  • optional

authentication token

Public Members

public auth: Object source

public collabPluginMetasUrl: string source

public favoritePluginMetasUrl: string source

public pipelinesUrl: string source

public pluginMetasUrl: * source

public pluginStarsUrl: string source

public pluginsUrl: string source

public url: string source

public userUrl: string source

Public Methods

public createPipeline(data: Object, timeout: number): Object source

Create a new pipeline resource through the REST API.

Params:

NameTypeAttributeDescription
data Object

request JSON data object

data.name string

pipeline name

data.plugin_tree string

JSON string containing a plugin tree list

data.authors string
  • optional

pipeline authors

data.category string
  • optional

pipeline category

data.description string
  • optional

pipeline description

data.locked boolean
  • optional
  • default: true

pipeline status

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to Pipeline object

public createPlugin(data: Object, uploadFileObj: Object, timeout: number): Object source

Create a new plugin resource through the REST API.

Params:

NameTypeAttributeDescription
data Object

request JSON data object

data.name string

plugin name

data.dock_image string

plugin docker image

data.public_repo string

plugin repo

uploadFileObj Object

custom file object

uploadFileObj.descriptor_file Object

file blob

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to Plugin object

public createPluginCollaborator(pluginMetaId: number, data: Object, timeout: number): Object source

Create a new plugin collaborator resource through the REST API.

Params:

NameTypeAttributeDescription
pluginMetaId number

plugin meta id

data Object

request JSON data object

data.username string

collaborator username

data.role string

collaborator role

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to PluginCollaborator object

public createPluginStar(data: Object, timeout: number): Object source

Create a new plugin star resource through the REST API.

Params:

NameTypeAttributeDescription
data Object

request JSON data object

data.plugin_name string

plugin's name

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to PluginStar object

public getCollabPluginMetas(params: Object, timeout: number): Object source

Fetch a list of authenticated user's collaborated plugin metas from the REST API.

Params:

NameTypeAttributeDescription
params Object
  • optional
  • default: null

page parameters object

params.limit number
  • optional

page limit

params.offset number
  • optional

page offset

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a UserCollabPluginMetaList object

public getFavoritePluginMetas(params: Object, timeout: number): Object source

Fetch a list of authenticated user's favorite plugin metas from the REST API.

Params:

NameTypeAttributeDescription
params Object
  • optional
  • default: null

page parameters object

params.limit number
  • optional

page limit

params.offset number
  • optional

page offset

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a UserFavoritePluginMetaList object

public getPipeline(id: number, timeout: number): Object source

Get a pipeline resource object given its id.

Params:

NameTypeAttributeDescription
id number

pipeline id

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a Pipeline object

public getPipelines(searchParams: Object, timeout: number): Object source

Get a paginated list of pipeline data (descriptors) given query search parameters. If no search parameters is given then get the default first page.

Params:

NameTypeAttributeDescription
searchParams Object
  • optional
  • default: null

search parameters

searchParams.limit number
  • optional

page limit

searchParams.offset number
  • optional

page offset

searchParams.id number
  • optional

match pipeline id exactly with this number

searchParams.name string
  • optional

match pipeline name containing this string

searchParams.category string
  • optional

match pipeline category containing this string

searchParams.owner_username string
  • optional

match pipeline's owner username exactly with this string

searchParams.description string
  • optional

match pipeline description containing this string

searchParams.authors string
  • optional

match pipeline authors containing this string

searchParams.min_creation_date string
  • optional

match pipeline creation date after this date

searchParams.max_creation_date string
  • optional

match pipeline creation date before this date

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a PipelineList object

public getPlugin(id: number, timeout: number): Object source

Get a plugin resource object given its id.

Params:

NameTypeAttributeDescription
id number

plugin id

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a Plugin object

public getPluginMeta(id: number, timeout: number): Object source

Get a plugin meta resource object given its id.

Params:

NameTypeAttributeDescription
id number

plugin meta id

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a PluginMeta object

public getPluginMetas(searchParams: Object, timeout: number): Object source

Get a paginated list of plugin metas from the REST API given query search parameters. If no search parameters then get the default first page.

Params:

NameTypeAttributeDescription
searchParams Object
  • optional
  • default: null

search parameters object

searchParams.limit number
  • optional

page limit

searchParams.offset number
  • optional

page offset

searchParams.id number
  • optional

match plugin meta id exactly with this number

searchParams.name string
  • optional

match plugin meta name containing this string

searchParams.name_exact string
  • optional

match plugin meta name exactly with this string

searchParams.title string
  • optional

match plugin meta title containing this string

searchParams.type string
  • optional

match plugin meta type exactly with this string

searchParams.category string
  • optional

match plugin meta category exactly with this string

searchParams.authors string
  • optional

match plugin meta authors containing this string

searchParams.min_creation_date number
  • optional

match feed creation date gte this date

searchParams.max_creation_date number
  • optional

match feed creation date lte this date

searchParams.name_title_category string
  • optional

match plugin meta name, title or category containing this string

searchParams.name_authors_category string
  • optional

match plugin meta name, authors or category containing this string

searchParams.owner_username string
  • optional

match plugin meta owner's username exactly with this string

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a PluginMetaList object

public getPluginStar(id: number, timeout: number): Object source

Get an authenticated-user-specific plugin star resource object given its id.

Params:

NameTypeAttributeDescription
id number

plugin star id

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a PluginStar object

public getPluginStars(searchParams: Object, timeout: number): Object source

Get a paginated list of authenticated-user-specific plugin star data (descriptors) given query search parameters. If no search parameters is given then get the default first page.

Params:

NameTypeAttributeDescription
searchParams Object
  • optional
  • default: null

search parameters

searchParams.limit number
  • optional

page limit

searchParams.offset number
  • optional

page offset

searchParams.id number
  • optional

match plugin star id exactly with this number

searchParams.plugin_name string
  • optional

match plugin name exactly with this string

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a PluginStarList object

public getPlugins(searchParams: Object, timeout: number): Object source

Get a paginated list of plugin data (descriptors) given query search parameters. If no search parameters is given then get the default first page.

Params:

NameTypeAttributeDescription
searchParams Object
  • optional
  • default: null

search parameters

searchParams.limit number
  • optional

page limit

searchParams.offset number
  • optional

page offset

searchParams.id number
  • optional

match plugin id exactly with this number

searchParams.name string
  • optional

match plugin name containing this string

searchParams.name_latest string
  • optional

match plugin name containing this string and return only the latest version

searchParams.name_exact string
  • optional

match plugin name exactly with this string

searchParams.name_exact_latest string
  • optional

match plugin name exactly with this string and return only the latest version

searchParams.dock_image string
  • optional

match plugin docker image exactly with this string

searchParams.type string
  • optional

match plugin type with this string

searchParams.category string
  • optional

match plugin category containing this string

searchParams.owner_username string
  • optional

match plugin username containing this string

searchParams.min_creation_date string
  • optional

match plugin creation date after this date

searchParams.max_creation_date string
  • optional

match plugin creation date before this date

searchParams.title string
  • optional

match plugin title containing this string

searchParams.version string
  • optional

match plugin version exactly with this string

searchParams.description string
  • optional

match plugin description containing this string

searchParams.name_title_category string
  • optional

match plugin name, title or category containing this string

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a PluginList object

public getUser(timeout: number): Object source

Get a user resource object for the currently authenticated user.

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise, resolves to a User object

public setUrls(timeout: number): Object source

Set the urls of the high level API resources.

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise

Private Methods

private _fetchRes(resUrlProp: string, ResClass: string, searchParams: Object, timeout: number): Object source

Internal method to fetch a high level resource through the REST API.

Params:

NameTypeAttributeDescription
resUrlProp string

property of the this object containing the url of the resource

ResClass string

resource class

searchParams Object
  • optional
  • default: null

search parameters object

timeout number
  • optional
  • default: 30000

request timeout

Return:

Object

JS Promise