Custom categories resources
- Copyright:
- 2015–2020 RewardOps Inc.
- 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.
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:
-
module:resources/custom-categories~GetAllFuncfor examples.
Returns:
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 |
- Source:
- See:
-
module:resources/custom-categories~GetFuncfor examples.
Returns:
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 |
- 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);
}
});