Module

resources/custom-categories

Custom categories resources

View Source resources/custom-categories.js, line 1

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

View Source resources/custom-categories.js, line 157

Returns Custom categories object.

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

See:

View Source resources/custom-categories.js, line 22

Returns getAll program custom categories function.

# 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

See:

View Source resources/custom-categories.js, line 75

Returns get program custom categories function.

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

View Source resources/custom-categories.js, line 163

# 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

View Source resources/custom-categories.js, line 49

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

View Source resources/custom-categories.js, line 126

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);
  }
});