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

Feed

Extends:

ResourceItemResource → Feed

Feed item resource object representing a feed.

Method Summary

Public Methods
public

addComment(title: string, content: string, timeout: number): Promise<Comment>

Add a new comment to the feed.

public

Add a group permission to access the feed.

public

addTagging(tag_id: number, timeout: number): Promise<Tagging>

Add a new tagging to the feed (tag the feed) given the id of the tag.

public

Add a user permission to access the feed.

public

delete(timeout: number): Promise

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

public

Get a feed comment given its id.

public

getComments(searchParams: Object, timeout: number): Promise<CommentList>

Fetch a list of comments associated to this feed from the REST API.

public

Fetch the folder associated to this feed from the REST API.

public

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

public

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

public

getNote(timeout: number): Promise<Note>

Fetch the note associated to this feed from the REST API.

public

Fetch a list of plugin instances associated to this feed from the REST API.

public

Fetch a list of taggings associated to this feed from the REST API.

public

getTags(params: Object, timeout: number): Promise<FeedTagList>

Fetch a list of tags associated to this feed from the REST API.

public

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

public

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

public

makePublic(timeout: number): Promise<this>

Make the feed public.

public

makeUnpublic(timeout: number): Promise<this>

Make the feed unpublic.

public

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

Make a PUT request to modify this feed 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 addComment(title: string, content: string, timeout: number): Promise<Comment> source

Add a new comment to the feed.

Params:

NameTypeAttributeDescription
title string
  • optional

title of the comment

content string
  • optional

content of the comment

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<Comment>

JS Promise, resolves to a Comment object

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

Add a group permission to access the feed.

Params:

NameTypeAttributeDescription
group_name string

group's name

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FeedGroupPermission>

JS Promise, resolves to a FeedGroupPermission object

public addTagging(tag_id: number, timeout: number): Promise<Tagging> source

Add a new tagging to the feed (tag the feed) given the id of the tag.

Params:

NameTypeAttributeDescription
tag_id number

tag id

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<Tagging>

JS Promise, resolves to a Tagging object

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

Add a user permission to access the feed.

Params:

NameTypeAttributeDescription
username string

user's username

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FeedUserPermission>

JS Promise, resolves to a FeedUserPermission object

public delete(timeout: number): Promise source

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

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise

JS Promise

public getComment(id: number, timeout: number): Promise<Comment> source

Get a feed comment given its id.

Params:

NameTypeAttributeDescription
id number

comment id

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<Comment>

JS Promise, resolves to a Comment object

public getComments(searchParams: Object, timeout: number): Promise<CommentList> source

Fetch a list of comments associated to this feed 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 comment id exactly with this number

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<CommentList>

JS Promise, resolves to a CommentList object

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

Fetch the folder associated to this feed from the REST API.

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FileBrowserFolder>

JS Promise, resolves to a FileBrowserFolder object

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

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

Params:

NameTypeAttributeDescription
group_name string

feed group permission's group name

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FeedGroupPermission|null>

JS Promise, resolves to a FeedGroupPermission object or null

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

Fetch a list of group permissions associated to this feed 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 feed 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<FeedGroupPermissionList>

JS Promise, resolves to a FeedGroupPermissionList object

public getNote(timeout: number): Promise<Note> source

Fetch the note associated to this feed from the REST API.

Params:

NameTypeAttributeDescription
timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<Note>

JS Promise, resolves to a Note object

public getPluginInstances(params: Object, timeout: number): Promise<FeedPluginInstanceList> source

Fetch a list of plugin instances associated to this feed 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<FeedPluginInstanceList>

JS Promise, resolves to a FeedPluginInstanceList object

public getTaggings(params: Object, timeout: number): Promise<FeedTaggingList> source

Fetch a list of taggings associated to this feed 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<FeedTaggingList>

JS Promise, resolves to a FeedTaggingList object

public getTags(params: Object, timeout: number): Promise<FeedTagList> source

Fetch a list of tags associated to this feed 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<FeedTagList>

JS Promise, resolves to a FeedTagList object

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

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

Params:

NameTypeAttributeDescription
username string

feed user permission's username

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<FeedUserPermission|null>

JS Promise, resolves to a FeedUserPermission object or null

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

Fetch a list of user permissions associated to this feed 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 feed 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<FeedUserPermissionList>

JS Promise, resolves to a FeedUserPermissionList object

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

Make the feed 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 feed 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 feed item resource through the REST API.

Params:

NameTypeAttributeDescription
data Object

request JSON data object

data.name string
  • optional

name of the feed

data.public boolean
  • optional

public status of the feed

timeout number
  • optional
  • default: 30000

request timeout

Return:

Promise<this>

JS Promise, resolves to this object