Home Manual Reference Source
private class | source

CategoryController

Controller class for the Category model.

Constructor Summary

Public Constructor
public

constructor(connection: Connection)

Member Summary

Private Members
private

Object to use for making a connection to the REST API and Websocket server.

Method Summary

Public Methods
public

Create a category.

public

getCategories(urlModification: undefined): *

public

Get and return all categories which have a specific category as parent.

public

Get a category.

public

Get and return all top level categories which do not have a parent Category.

Public Constructors

public constructor(connection: Connection) source

Params:

NameTypeAttributeDescription
connection Connection

Object to use for making a connection to the REST API and Websocket server.

Private Members

private _connection: Connection source

Object to use for making a connection to the REST API and Websocket server.

Public Methods

public createCategory(category: Category): Promise<Category> source

Create a category.

Params:

NameTypeAttributeDescription
category Category

Object to create.

Return:

Promise<Category>

Promise containing the newly created Category.

Throw:

Promise.<Error>

category parameter of type "Category" is required.

Promise.<Error>

If the server returned an error.

public getCategories(urlModification: undefined): * source

Params:

NameTypeAttributeDescription
urlModification undefined
  • optional
  • default: undefined

Return:

*

public getCategoriesWithParent(parentId: string): Promise<Category[]> source

Get and return all categories which have a specific category as parent.

Params:

NameTypeAttributeDescription
parentId string

Specify a category parent identifier.

Return:

Promise<Category[]>

Promise containing an array of Categories.

Throw:

Promise.<Error>

parentId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getCategory(categoryId: string): Promise<Category> source

Get a category.

Params:

NameTypeAttributeDescription
categoryId string

Specify a category identifier.

Return:

Promise<Category>

Promise containing an Category.

Throw:

Promise.<Error>

categoryId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getTopLevelCategories(groupId: string): Promise<Category[]> source

Get and return all top level categories which do not have a parent Category.

Params:

NameTypeAttributeDescription
groupId string
  • optional

The ID of the group for which to fetch the categories.

Return:

Promise<Category[]>

Promise containing an array of Categories.

Throw:

Promise.<Error>

If no result could not be found.