Module: resources/custom-categories

Custom categories resources

Source:

Methods

(inner) customCategories(programId) → {module:resources/custom-categories~CustomCategories}

Factory for categories objects.

Parameters:
Name Type Description
programId number

The ID of the category's parent program

Source:
Returns:

Returns Custom categories object.

Type
module:resources/custom-categories~CustomCategories
Example
// Returns a custom categories object for the program with ID 55
var categories = ro.program(756).customCategories;

(protected, inner) getAllProgramCustomCategories(programId) → {module:resources/custom-categories~GetAllFunc}

Higher order function for creating a getAll program custom categories function.

Parameters:
Name Type Description
programId number

The ID of the custom category's parent program

Source:
See:
Returns:

Returns getAll program custom categories function.

Type
module:resources/custom-categories~GetAllFunc

(protected, inner) getProgramCustomCategory(programId) → {module:resources/custom-categories~GetFunc}

Higher order function for creating a get program custom categories function.

Parameters:
Name Type Description
programId number

The ID of the custom category's parent program

Source:
See:
Returns:

Returns get program custom categories function.

Type
module:resources/custom-categories~GetFunc

Type Definitions

CustomCategories

Custom categories object.

Properties:
Name Type Description
programId number

The ID of the category's parent program

get module:resources/custom-categories~GetFunc

Get custom category function

getAll module:resources/custom-categories~GetAllFunc

Get all custom categories function

Source:

GetAllFunc

Function for getting an array of customCategory JSON objects.

Properties:
Name Type Attributes Description
params object <optional>

Request params to pass to the API call

callback module:api~requestCallback

Callback that handles the response

Source:
Example
// Gets an array of customCategory objects the program with id 12
ro.program(12).customCategories.getAll((error, data) => {
  // ...
});

GetFunc

Function for getting a customCategory JSON object.

Properties:
Name Type Description
code string

Custom category code

params object

Request params to pass to the API call

callback module:api~requestCallback

Callback that handles the response

Source:
Example
// Get JSON for the customCategory with code CAT_000002
ro.program(12).customCategories.get('CAT_000002', (error, responseBody, response) => {
  if (error) {
    console.log(error);
  } else {
    console.log(result);
  }
});