api/categories

This file contains the readily available functions which interact with the ITSLanguage categories API.

Categorize Speech Challenges or categories.

Source:
See:

Members

(inner, constant) url :string

Source:

The URL for the category handler(s).

Type:
  • string

Methods

(static) create(category) → {Promise}

Source:

Create a new category.

The most convenient way to pas a category to this create function is to make use of the FormData object.

Parameters:
Name Type Description
category Object

The category to create.

Properties
Name Type Attributes Description
id string <optional>

The category identifier. If none is given, one is generated.

parent string <optional>

Identifier of the parent category.

name string <optional>

A name for the category.

description string <optional>

A possible more verbose description about the category.

color string <optional>

A color, preferably in RGB format.

image blob <optional>

An image to show with the category.

icon blob <optional>

An icon to show with the category.

speechChallenges string <optional>

Speech Challenge identifiers categorized in the category.

Returns:
  • The category creation promise.
Type
Promise

(static) getAll(filtersopt) → {Promise}

Source:

Get a all top level categories. Top level categories are categories without a parent category.

By default all categories are fetched though it is allowed to pass filters as a URLSearchParams object.

Parameters:
Name Type Attributes Description
filters URLSearchParams <optional>

The filters to apply to the category list.

Throws:
  • If the given optional filters are not an instance of URLSearchParams.
Type
Promise.<string>
Returns:
  • The promise for the categories.
Type
Promise

(static) getAllWithParentId(id) → {Promise}

Source:

Get all categories that share the same parent.

Parameters:
Name Type Description
id string

The category identifier.

Returns:
  • A promise and when fulfilled the requested categories.
Type
Promise

(static) getById(id) → {Promise}

Source:

Get a single category by its ID.

Parameters:
Name Type Description
id string

The ID of the desired category.

Returns:
  • The promise for the category.
Type
Promise

(static) update(id, properties) → {Promise}

Source:

Update one or more properties of an existing category.

Parameters:
Name Type Description
id string

The category identified.

properties Object

The properties of the category to update.

Properties
Name Type Attributes Description
parent string <optional>

Identifier of the parent category.

name string <optional>

A name for the category.

description string <optional>

A more verbose description about the category.

color string <optional>

A color, preferably in RGB format.

image blob <optional>

An image to show with the category.

icon blob <optional>

An icon to show with the category.

speechChallenges Array <optional>

An array of Speech Challenges identifiers categorized in the category.

Returns:
  • The category update promise.
Type
Promise