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

FileBrowserFolder

Extends:

ResourceItemResource → FileBrowserFolder

File browser folder item resource object representing a folder.

Method Summary

Public Methods
public

addGroupPermission(group_name: string, permission: string, timeout: number): Promise<FolderGroupPermission>

Add a group permission to access the folder.

public

addUserPermission(username: string, permission: string, timeout: number): Promise<FolderUserPermission>

Add a user permission to access the folder.

public

delete(timeout: number): Promise

Make a DELETE request to delete this file browser folder item resource through the REST API.

public

Fetch a list of folders that are the children of this folder from the REST API.

public

Fetch a list of files directly under this folder from the REST API.

public

Get a folder group permission given the name of the group.

public

Fetch a list of group permissions associated to this folder from the REST API.

public

Fetch a list of link files directly under this folder from the REST API.

public

Fetch the parent folder of this folder from the REST API.

public

Get a folder user permission given the username of the user.

public

Fetch a list of user permissions associated to this folder from the REST API.

public

makePublic(timeout: number): Promise<this>

Make the folder public.

public

makeUnpublic(timeout: number): Promise<this>

Make the folder unpublic.

public

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

Make a PUT request to modify this folder item resource through 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 Methods

public addGroupPermission(group_name: string, permission: string, timeout: number): Promise<FolderGroupPermission> source

Add a group permission to access the folder.

Params:

NameTypeAttributeDescription
group_name string

group's name

permission string

permission, can be 'r' or 'w'

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FolderGroupPermission>

JS Promise, resolves to a FolderGroupPermission object

public addUserPermission(username: string, permission: string, timeout: number): Promise<FolderUserPermission> source

Add a user permission to access the folder.

Params:

NameTypeAttributeDescription
username string

user's username

permission string

permission, can be 'r' or 'w'

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FolderUserPermission>

JS Promise, resolves to a FolderUserPermission object

public delete(timeout: number): Promise source

Make a DELETE request to delete this file browser folder item resource through the REST API.

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise

JS Promise

public getChildren(params: Object, timeout: number): Promise<FileBrowserFolderChildList> source

Fetch a list of folders that are the children of this folder 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:

Promise<FileBrowserFolderChildList>

JS Promise, resolves to a FileBrowserFolderChildList object

public getFiles(params: Object, timeout: number): Promise<FileBrowserFolderFileList> source

Fetch a list of files directly under this folder 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:

Promise<FileBrowserFolderFileList>

JS Promise, resolves to a FileBrowserFolderFileList object

public getGroupPermission(group_name: string, timeout: number): Promise<FolderGroupPermission|null> source

Get a folder group permission given the name of the group.

Params:

NameTypeAttributeDescription
group_name string

folder group permission's group name

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FolderGroupPermission|null>

JS Promise, resolves to a FolderGroupPermission object or null

public getGroupPermissions(searchParams: Object, timeout: number): Promise<FolderGroupPermissionList> source

Fetch a list of group permissions associated to this folder 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 folder group permission id exactly with this number

searchParams.group_name string
  • optional

match group name exactly with this string

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FolderGroupPermissionList>

JS Promise, resolves to a FolderGroupPermissionList object

public getLinkFiles(params: Object, timeout: number): Promise<FileBrowserFolderLinkFileList> source

Fetch a list of link files directly under this folder 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:

Promise<FileBrowserFolderLinkFileList>

JS Promise, resolves to a FileBrowserFolderLinkFileList object

public getParent(timeout: number): Promise<FileBrowserFolder> source

Fetch the parent folder of this folder from the REST API.

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FileBrowserFolder>

JS Promise, resolves to a FileBrowserFolder object

public getUserPermission(username: string, timeout: number): Promise<FolderUserPermission|null> source

Get a folder user permission given the username of the user.

Params:

NameTypeAttributeDescription
username string

folder user permission's username

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FolderUserPermission|null>

JS Promise, resolves to a FolderUserPermission object or null

public getUserPermissions(searchParams: Object, timeout: number): Promise<FolderUserPermissionList> source

Fetch a list of user permissions associated to this folder 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 folder user permission id exactly with this number

searchParams.username string
  • optional

match username exactly with this string

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FolderUserPermissionList>

JS Promise, resolves to a FolderUserPermissionList object

public makePublic(timeout: number): Promise<this> source

Make the folder public.

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<this>

JS Promise, resolves to this object

public makeUnpublic(timeout: number): Promise<this> source

Make the folder unpublic.

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<this>

JS Promise, resolves to this object

public put(data: Object, timeout: number): Promise<this> source

Make a PUT request to modify this folder item resource through the REST API.

Params:

NameTypeAttributeDescription
data Object

request JSON data object

data.public boolean

public status of the folder

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<this>

JS Promise, resolves to this object