Rewards resources
- Copyright:
- 2015–2023 RewardOps Inc.
- Source:
- Copyright:
- 2015–2020 RewardOps Inc.
- Source:
Methods
(protected, inner) getAllProgramRewards(programId) → {module:resources/rewards~GetAllProgramRewards}
Higher order function for getAll function program rewards.
Parameters:
| Name | Type | Description |
|---|---|---|
programId |
number | The ID of the reward's parent program. |
- Source:
- See:
-
module:resources/rewards~GetAllProgramRewardsfor examples.
Returns:
Returns an async getAll function for program rewards.
(protected, inner) getProgramReward(programId) → {GetProgramRewards}
Higher order function for get function program rewards.
Parameters:
| Name | Type | Description |
|---|---|---|
programId |
number | The ID of the reward's parent program. |
- Source:
- See:
-
GetProgramRewardsfor examples.
Returns:
Returns an async get function for a program reward.
- Type
- GetProgramRewards
(protected, inner) postValidate(params, callback)
Checks if a coupon is valid or not.
Parameters:
| Name | Type | Description |
|---|---|---|
params |
Object | Request params. |
callback |
Object | function to be called after getting an API response |
- Source:
(inner) rewardsFactory(programId) → {Object}
Factory for rewards objects.
Parameters:
| Name | Type | Description |
|---|---|---|
programId |
number | The ID of the rewards' parent program |
- Source:
Returns:
Returns programId as well as get and getAll program rewards functions.
- Type
- Object
Example
// Returns a rewards object for the program with ID 756
const rewards = ro.program(756).rewards;
Type Definitions
GetAllProgramRewards
Get a list of rewards.
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
params |
object |
<optional> |
A params object to send with the API request. |
callback |
module:api~requestCallback | callback Callback that handles the response. |
- Source:
Example
// Gets a list of all running rewards for the program.
myProgram.rewards.getAll(
{
status: 'running',
},
(error, responseBody, response) => {
if (error) {
console.log(error);
} else {
console.log(result);
}
}
);
GetProgramRewards
Get a reward JSON object by ID.
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
id |
string | number | A program reward ID |
|
params |
object |
<optional> |
A params object to send with the API request. |
callback |
module:api~requestCallback | callback Callback that handles the response. |
- Source:
Example
// Get JSON for the reward with ID 938
ro.program(12).rewards.get(938, (error, responseBody, response) => {
if (error) {
console.log(error);
} else {
console.log(result);
}
});