Home Reference Source
import {Group} from '@fnndsc/chrisapi'
public class | source

Group

Extends:

ResourceItemResource → Group

Group item resource object representing a group.

Constructor Summary

Public Constructor
public

constructor(url: string, auth: Object)

Constructor

Method Summary

Public Methods
public

adminAddUser(username: string, timeout: number): Promise<GroupUser>

Add a user to the group given the user's username.

public

delete(timeout: number): Promise

Make a DELETE request to delete this group item resource through the REST API.

public

getUser(username: string, timeout: number): Promise<GroupUser|null>

Get a group user given the username.

public

getUsers(searchParams: Object, timeout: number): Promise<GroupUserList>

Fetch the list of group's users from the REST API.

Inherited Summary

From class Resource
public static

cloneObj(obj: Object): *

Helper method to make a deep copy clone of the passed object resource.

public get

Return true if the resource object contains any data.

public
public
public
public
public

Make a deep copy clone of this object resource.

From class ItemResource
public get

Get the item's data object (REST API descriptors).

public
public

get(timeout: number): Promise<this>

Fetch this item resource from the REST API.

public

Get an array of parameter names that can be used as properties of the data object in PUT requests.

private

_delete(timeout: number): Promise

Internal helper method to make a DELETE request to this item resource through the REST API.

private

_getResource(linkRelation: string, ResourceClass: Object, searchParams: Object, timeout: number): Promise<ResourceClass>

Internal method to fetch a related resource from the REST API that is referenced by a link relation within the item object.

private

_put(data: Object, uploadFileObj: Object, timeout: number): Promise<this>

Internal helper method to make a PUT request to this item resource through the REST API.

Public Constructors

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

Constructor

Override:

ItemResource#constructor

Params:

NameTypeAttributeDescription
url string

url of the resource

auth Object

authentication object

auth.token string

authentication token

Public Methods

public adminAddUser(username: string, timeout: number): Promise<GroupUser> source

Add a user to the group given the user's username.

Params:

NameTypeAttributeDescription
username string

user's username

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<GroupUser>

JS Promise, resolves to a GroupUser object

public delete(timeout: number): Promise source

Make a DELETE request to delete this group item resource through the REST API.

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise

JS Promise

public getUser(username: string, timeout: number): Promise<GroupUser|null> source

Get a group user given the username.

Params:

NameTypeAttributeDescription
username string

group user username

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<GroupUser|null>

JS Promise, resolves to a GroupUser object or null

public getUsers(searchParams: Object, timeout: number): Promise<GroupUserList> source

Fetch the list of group's users from the REST API.

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 group-user id exactly with this number

searchParams.username string
  • optional

match the username exactly with this string

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<GroupUserList>

JS Promise, resolves to a GroupUserList object