Module

resources/rewards

Rewards resources

View Source resources/coupons.js, line 1

View Source resources/rewards.js, line 1

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:

View Source resources/rewards.js, line 22

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.

View Source resources/rewards.js, line 87

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

View Source resources/coupons.js, line 22

# inner rewardsFactory(programId) → {Object}

Factory for rewards objects.

Parameters:
Name Type Description
programId number

The ID of the rewards' parent program

View Source resources/rewards.js, line 147

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.

View Source resources/rewards.js, line 50

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.

View Source resources/rewards.js, line 115

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

Rewards resources

View Source resources/coupons.js, line 1

View Source resources/rewards.js, line 1

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:

View Source resources/rewards.js, line 22

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.

View Source resources/rewards.js, line 87

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

View Source resources/coupons.js, line 22

# inner rewardsFactory(programId) → {Object}

Factory for rewards objects.

Parameters:
Name Type Description
programId number

The ID of the rewards' parent program

View Source resources/rewards.js, line 147

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.

View Source resources/rewards.js, line 50

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.

View Source resources/rewards.js, line 115

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