import CategoryController from 'itslanguage/administrative-sdk/category/category-controller.js'
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 |
createCategory(category: Category): Promise<Category> Create a category. |
|
public |
getCategories(urlModification: undefined): * |
|
public |
getCategoriesWithParent(parentId: string): Promise<Category[]> Get and return all categories which have a specific category as parent. |
|
public |
getCategory(categoryId: string): Promise<Category> Get a category. |
|
public |
getTopLevelCategories(groupId: string): Promise<Category[]> Get and return all top level categories which do not have a parent Category. |
Public Constructors
public constructor(connection: Connection) source
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
category | Category | Object to create. |
Throw:
Promise.<Error> |
category parameter of type "Category" is required. |
Promise.<Error> |
If the server returned an error. |
public getCategories(urlModification: undefined): * source
Params:
Name | Type | Attribute | Description |
urlModification | undefined |
|
Return:
* |
public getCategoriesWithParent(parentId: string): Promise<Category[]> source
Get and return all categories which have a specific category as parent.
Params:
Name | Type | Attribute | Description |
parentId | string | Specify a category parent identifier. |
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:
Name | Type | Attribute | Description |
categoryId | string | Specify a category identifier. |
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:
Name | Type | Attribute | Description |
groupId | string |
|
The ID of the group for which to fetch the categories. |
Throw:
Promise.<Error> |
If no result could not be found. |