Rewards resources
- Copyright:
- 2015–2023 RewardOps Inc.
- Copyright:
- 2015–2020 RewardOps Inc.
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. |
- See:
-
module:resources/rewards~GetAllProgramRewards
for examples.
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. |
- See:
-
GetProgramRewards
for examples.
Returns an async get
function for a program reward.
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 |
# inner rewardsFactory(programId) → {Object}
Factory for rewards objects.
Parameters:
Name | Type | Description |
---|---|---|
programId |
number
|
The ID of the rewards' parent program |
Returns programId
as well as get
and getAll
program rewards functions.
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. |
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. |
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);
}
});