npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

geniusreferrals

v1.0.1

Published

The Genius Referrals API

Downloads

9

Readme

Getting started

How to Build

The generated SDK relies on Node Package Manager (NPM) being available to resolve dependencies. If you don't already have NPM installed, please go ahead and follow instructions to install NPM from here. The SDK also requires Node to be installed. If Node isn't already installed, please install it from here

NPM is installed by default when Node is installed

To check if node and npm have been successfully installed, write the following commands in command prompt:

  • node --version
  • npm -version Version Check

Now use npm to resolve all dependencies by running the following command in the root directory (of the SDK folder):

  • npm install Resolve Dependencies Resolve Dependencies

This will install all dependencies in the node_modules folder.

Once dependencies are resolved, you will need to move the folder GeniusReferrals in to your node_modules folder.

How to Use

The following section explains how to use the library in a new project.

1. Open Project Folder

Open an IDE/Text Editor for JavaScript like Sublime Text. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
Click on File and select Open Folder Open Folder

Select the folder of your SDK and click on Select Folder to open it up in Sublime Text. The folder will become visible in the bar on the left. Open Project

2. Creating a Test File

Now right click on the folder name and select the New File option to create a new test file. Save it as index.js Now import the generated NodeJS library using the following lines of code:

var lib = require('lib');

Save changes.

Create new file Save new file

3. Running The Test File

To run the index.js file, open up the command prompt and navigate to the Path where the SDK folder resides. Type the following command to run the file:
node index.js Run file

How to Test

These tests use Mocha framework for testing, coupled with Chai for assertions. These dependencies need to be installed for tests to run. Tests can be run in a number of ways:

Method 1

(Run all tests)
  1. Navigate to the root directory of the SDK folder from command prompt.
  2. Type mocha --recursive to run all the tests.

Method 2

(Run all tests)
  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. Type mocha * to run all the tests.

Method 3

(Run specific controller's tests)
  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. Type mocha Genius ReferralsController to run all the tests in that controller file.

To increase mocha's default timeout, you can change the TESTTIMEOUT parameter's value in Configuration.js.
NOTE: Changing default timeout is available for only Binary/File type endpoint tests

Run Tests

Initialization

Authentication

In order to setup authentication and initialization of the API client, you need the following information.

| Parameter | Description | |-----------|-------------| | contentType | The content type | | xAuthToken | Your API Token, you can get your token here https://www.geniusreferrals.com/en/settings/api-access |

API client can be initialized as following:

// Configuration parameters and credentials
$contentType = "application/json"; // The content type
$xAuthToken = "3b9d11374b602fb47b987dff90f1c5940a1f377f"; // Your API Token, you can get your token here https://www.geniusreferrals.com/en/settings/api-access

var lib = require('lib');

Class Reference

List of Controllers

Class: RootsController

Get singleton instance

The singleton instance of the RootsController class can be accessed from the API Client.

var controller = lib.RootsController;

Method: getRoot

The root of the API

function getRoot(callback)

Example Usage



    controller.getRoot(function(error, response, context) {

    
	});

Back to List of Controllers

Class: AuthenticationsController

Get singleton instance

The singleton instance of the AuthenticationsController class can be accessed from the API Client.

var controller = lib.AuthenticationsController;

Method: getAuthentication

Allow clients to test authentication on Genius Referrals platform.

function getAuthentication(callback)

Example Usage



    controller.getAuthentication(function(error, response, context) {

    
	});

Back to List of Controllers

Class: AdvocatesController

Get singleton instance

The singleton instance of the AdvocatesController class can be accessed from the API Client.

var controller = lib.AdvocatesController;

Method: deleteAdvocate

Delete an advocate

function deleteAdvocate(accountSlug, advocateToken, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;

    controller.deleteAdvocate(accountSlug, advocateToken, function(error, response, context) {

    
	});

Method: putAdvocate

Update an advocate.

function putAdvocate(accountSlug, advocateToken, advocateForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | advocateForm | Required | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocateForm = new AdvocateForm({"key":"value"});

    controller.putAdvocate(accountSlug, advocateToken, advocateForm, function(error, response, context) {

    
	});

Method: postAdvocate

Create a new advocate.

function postAdvocate(accountSlug, advocateForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateForm | Required | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var advocateForm = new AdvocateForm({"key":"value"});

    controller.postAdvocate(accountSlug, advocateForm, function(error, response, context) {

    
	});

Method: getAdvocate

Get an advocate by a given token.

function getAdvocate(accountSlug, advocateToken, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;

    controller.getAdvocate(accountSlug, advocateToken, function(error, response, context) {

    
	});

Method: deleteAdvocates

Delete all advocates

function deleteAdvocates(accountSlug, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier |

Example Usage


    var accountSlug = account_slug;

    controller.deleteAdvocates(accountSlug, function(error, response, context) {

    
	});

Method: getAdvocates

Get the list of advocates

function getAdvocates(accountSlug, page, limit, filter, sort, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | page | Optional DefaultValue | Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. | | limit | Optional DefaultValue | Maximum number of results to return in the response. Default (10), threshold (100) | | filter | Optional | Allowed fields: name, lastname, email, advocate_token, bonus_exchange_method_slug, campaign_slug, can_refer, is_referral, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' | | sort | Optional | Allowed fields: name, lastname, email, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |

Example Usage


    var accountSlug = account_slug;
    var page = 64;
    var limit = 64;
    var filter = "filter";
    var sort = "sort";

    controller.getAdvocates(accountSlug, page, limit, filter, sort, function(error, response, context) {

    
	});

Method: patchAdvocate

Update partial elements of an advocate.

function patchAdvocate(accountSlug, advocateToken, advocatePatchForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | advocatePatchForm | Required Collection | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocatePatchForm = [{"key":"value"}].map(function(elem) {
        return new Advocate Patch Form(elem);
    });

    controller.patchAdvocate(accountSlug, advocateToken, advocatePatchForm, function(error, response, context) {

    
	});

Method: getShareLinks

Get the advocates share links. These are the links that advocates use to share your services online. Share links are wrapped per campaign and widget package.

function getShareLinks(accountSlug, advocateToken, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;

    controller.getShareLinks(accountSlug, advocateToken, function(error, response, context) {

    
	});

Method: putPaymentMethod

Update a payment method.

function putPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodId, advocatePaymentMethodForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The advocate's token | | advocateToken | Required | The advocate's token | | advocatePaymentMethodId | Required | The payment method's identifier | | advocatePaymentMethodForm | Required | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocatePaymentMethodId = 64;
    var advocatePaymentMethodForm = new PaymentMethodForm({"key":"value"});

    controller.putPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodId, advocatePaymentMethodForm, function(error, response, context) {

    
	});

Method: getPaymentMethod

Get an advocate's payment method

function getPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodId, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | advocatePaymentMethodId | Required | The payment method's identifier |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocatePaymentMethodId = 64;

    controller.getPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodId, function(error, response, context) {

    
	});

Method: postPaymentMethod

Create a new payment method.

function postPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | advocatePaymentMethodForm | Required | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocatePaymentMethodForm = new PaymentMethodForm({"key":"value"});

    controller.postPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodForm, function(error, response, context) {

    
	});

Method: getBonusRedemptionMethod

Get bonuses redemption method.

function getBonusRedemptionMethod(bonusesRedemptionMethodSlug, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | bonusesRedemptionMethodSlug | Required | The bonus redemption method's identifier |

Example Usage


    var bonusesRedemptionMethodSlug = bonuses_redemption_method_slug;

    controller.getBonusRedemptionMethod(bonusesRedemptionMethodSlug, function(error, response, context) {

    
	});

Method: getBonusRedemptionMethods

Get bonuses redemption methods.

function getBonusRedemptionMethods(callback)

Example Usage



    controller.getBonusRedemptionMethods(function(error, response, context) {

    
	});

Method: getCurrencies

Get currencies.

function getCurrencies(callback)

Example Usage



    controller.getCurrencies(function(error, response, context) {

    
	});

Method: getCurrency

Get a currency.

function getCurrency(code, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | code | Required | The currency's code |

Example Usage


    var code = "code";

    controller.getCurrency(code, function(error, response, context) {

    
	});

Method: getPaymentMethods

Get the advocate's payment methods.

function getPaymentMethods(accountSlug, advocateToken, page, limit, filter, sort, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | page | Optional DefaultValue | Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. | | limit | Optional DefaultValue | Maximum number of results to return in the response. Default (10), threshold (100) | | filter | Optional | Allowed fields: username, is_active. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' | | sort | Optional | Allowed fields: username, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort=last_name|first_name|-hire_date |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var page = 155;
    var limit = 155;
    var filter = "filter";
    var sort = "sort";

    controller.getPaymentMethods(accountSlug, advocateToken, page, limit, filter, sort, function(error, response, context) {

    
	});

Back to List of Controllers

Class: AccountsController

Get singleton instance

The singleton instance of the AccountsController class can be accessed from the API Client.

var controller = lib.AccountsController;

Method: getAccount

Get an account by a given slug.

function getAccount(accountSlug, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier |

Example Usage


    var accountSlug = account_slug;

    controller.getAccount(accountSlug, function(error, response, context) {

    
	});

Method: getAccounts

Get the list of accounts.

function getAccounts(page, limit, filter, sort, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | page | Optional DefaultValue | Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. | | limit | Optional DefaultValue | Maximum number of results to return in the response. Default (10), threshold (100) | | filter | Optional | Allowed fields: name. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' | | sort | Optional | Allowed fields: name, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort=last_name|first_name|-hire_date |

Example Usage


    var page = 155;
    var limit = 155;
    var filter = "filter";
    var sort = "sort";

    controller.getAccounts(page, limit, filter, sort, function(error, response, context) {

    
	});

Back to List of Controllers

Class: ReportsController

Get singleton instance

The singleton instance of the ReportsController class can be accessed from the API Client.

var controller = lib.ReportsController;

Method: getReferralsSummaryPerOrigin

Get referrals summary per referral origin.

function getReferralsSummaryPerOrigin(advocateToken, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | advocateToken | Required | The advocate's token |

Example Usage


    var advocateToken = advocate_token;

    controller.getReferralsSummaryPerOrigin(advocateToken, function(error, response, context) {

    
	});

Method: getBonusesSummaryPerOrigin

Get bonuses summary per referral origin.

function getBonusesSummaryPerOrigin(advocateToken, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | advocateToken | Required | The advocate's token |

Example Usage


    var advocateToken = advocate_token;

    controller.getBonusesSummaryPerOrigin(advocateToken, function(error, response, context) {

    
	});

Method: getTopAdvocates

Get top 10 advocates.

function getTopAdvocates(accountSlug, campaignSlug, limit, from, to, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Optional | The account identifier | | campaignSlug | Optional | The campaign identifier | | limit | Optional DefaultValue | Maximum number of results to return in the response. Default (10) | | from | Optional | The datetime were the range of the search starts | | to | Optional | The datetime were the range of the search stops |

Example Usage


    var accountSlug = account_slug;
    var campaignSlug = campaign_slug;
    var limit = 155;
    var from = date("D M d, Y G:i");
    var to = date("D M d, Y G:i");

    controller.getTopAdvocates(accountSlug, campaignSlug, limit, from, to, function(error, response, context) {

    
	});

Method: getShareDailyParticipation

Get share daily participation.

function getShareDailyParticipation(accountSlug, campaignSlug, advocateToken, from, to, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Optional | The account identifier | | campaignSlug | Optional | The campaign identifier | | advocateToken | Optional | The advocate's token | | from | Optional | The datetime were the range of the search starts | | to | Optional | The datetime were the range of the search stops |

Example Usage


    var accountSlug = account_slug;
    var campaignSlug = campaign_slug;
    var advocateToken = advocate_token;
    var from = date("D M d, Y G:i");
    var to = date("D M d, Y G:i");

    controller.getShareDailyParticipation(accountSlug, campaignSlug, advocateToken, from, to, function(error, response, context) {

    
	});

Method: getReferralDailyParticipation

Get referral daily participation.

function getReferralDailyParticipation(accountSlug, campaignSlug, advocateToken, from, to, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Optional | The account identifier | | campaignSlug | Optional | The campaign identifier | | advocateToken | Optional | The advocate's token | | from | Optional | The datetime were the range of the search starts | | to | Optional | The datetime were the range of the search stops |

Example Usage


    var accountSlug = account_slug;
    var campaignSlug = campaign_slug;
    var advocateToken = advocate_token;
    var from = date("D M d, Y G:i");
    var to = date("D M d, Y G:i");

    controller.getReferralDailyParticipation(accountSlug, campaignSlug, advocateToken, from, to, function(error, response, context) {

    
	});

Method: getClickDailyParticipation

Get click daily participation.

function getClickDailyParticipation(accountSlug, campaignSlug, advocateToken, from, to, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Optional | The account identifier | | campaignSlug | Optional | The campaign identifier | | advocateToken | Optional | The advocate's token | | from | Optional | The datetime were the range of the search starts | | to | Optional | The datetime were the range of the search stops |

Example Usage


    var accountSlug = account_slug;
    var campaignSlug = campaign_slug;
    var advocateToken = advocate_token;
    var from = date("D M d, Y G:i");
    var to = date("D M d, Y G:i");

    controller.getClickDailyParticipation(accountSlug, campaignSlug, advocateToken, from, to, function(error, response, context) {

    
	});

Method: getBonusesDailyGiven

Get bonuses daily given.

function getBonusesDailyGiven(accountSlug, campaignSlug, advocateToken, from, to, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Optional | The account identifier | | campaignSlug | Optional | The campaign identifier | | advocateToken | Optional | The advocate identifier | | from | Optional | The datetime were the range of the search starts | | to | Optional | The datetime were the range of the search stops |

Example Usage


    var accountSlug = account_slug;
    var campaignSlug = campaign_slug;
    var advocateToken = advocate_token;
    var from = date("D M d, Y G:i");
    var to = date("D M d, Y G:i");

    controller.getBonusesDailyGiven(accountSlug, campaignSlug, advocateToken, from, to, function(error, response, context) {

    
	});

Back to List of Controllers

Class: ReferralsController

Get singleton instance

The singleton instance of the ReferralsController class can be accessed from the API Client.

var controller = lib.ReferralsController;

Method: getReferralOrigin

Get a referral origin by a given slug.

function getReferralOrigin(referralOriginSlug, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | referralOriginSlug | Required | The referral origin identifier |

Example Usage


    var referralOriginSlug = referral_origin_slug;

    controller.getReferralOrigin(referralOriginSlug, function(error, response, context) {

    
	});

Method: getReferralOrigins

Get referral origins. This is needed when creating (POST) a new referral, as referral_origin_slug refers to one of this origins.

function getReferralOrigins(callback)

Example Usage



    controller.getReferralOrigins(function(error, response, context) {

    
	});

Method: getReferral

Get a referral by a given id.

function getReferral(accountSlug, advocateToken, referralId, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | referralId | Required | The referral id |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var referralId = referral_id;

    controller.getReferral(accountSlug, advocateToken, referralId, function(error, response, context) {

    
	});

Method: deleteReferral

Delete a referral.

function deleteReferral(accountSlug, advocateToken, referralId, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | referralId | Required | The referral identifier |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var referralId = referral_id;

    controller.deleteReferral(accountSlug, advocateToken, referralId, function(error, response, context) {

    
	});

Method: postReferral

Create a new referral.

function postReferral(accountSlug, advocateToken, referralForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | referralForm | Required | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var referralForm = new ReferralForm({"key":"value"});

    controller.postReferral(accountSlug, advocateToken, referralForm, function(error, response, context) {

    
	});

Method: putReferral

Update a referral.

function putReferral(accountSlug, advocateToken, referralId, referralForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | referralId | Required | The referral id | | referralForm | Required | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var referralId = referral_id;
    var referralForm = new ReferralForm({"key":"value"});

    controller.putReferral(accountSlug, advocateToken, referralId, referralForm, function(error, response, context) {

    
	});

Method: getReferrals

Get the list of referrals for a given advocate.

function getReferrals(accountSlug, advocateToken, page, limit, filter, sort, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The advocate's token | | page | Optional DefaultValue | Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. | | limit | Optional DefaultValue | Maximum number of results to return in the response. Default (10), threshold (100) | | filter | Optional | Allowed fields: url, referral_origin_slug, created. Use the following delimiters to build your filters params. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' | | sort | Optional | Allowed fields: created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var page = 155;
    var limit = 155;
    var filter = "filter";
    var sort = "sort";

    controller.getReferrals(accountSlug, advocateToken, page, limit, filter, sort, function(error, response, context) {

    
	});

Back to List of Controllers

Class: RedemptionRequestsController

Get singleton instance

The singleton instance of the RedemptionRequestsController class can be accessed from the API Client.

var controller = lib.RedemptionRequestsController;

Method: getRedemptionRequestStatus

Get a redemption request status.

function getRedemptionRequestStatus(redemptionRequestStatusSlug, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | redemptionRequestStatusSlug | Required | The redemption request status identifier |

Example Usage


    var redemptionRequestStatusSlug = redemption_request_status_slug;

    controller.getRedemptionRequestStatus(redemptionRequestStatusSlug, function(error, response, context) {

    
	});

Method: getRedemptionRequestStatuses

Get redemption request statuses.

function getRedemptionRequestStatuses(callback)

Example Usage



    controller.getRedemptionRequestStatuses(function(error, response, context) {

    
	});

Method: getRedemptionRequestAction

Get a redemption request action.

function getRedemptionRequestAction(redemptionRequestActionSlug, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | redemptionRequestActionSlug | Required | The redemption request action identifier |

Example Usage


    var redemptionRequestActionSlug = redemption_request_action_slug;

    controller.getRedemptionRequestAction(redemptionRequestActionSlug, function(error, response, context) {

    
	});

Method: getRedemptionRequestActions

Get redemption request actions.

function getRedemptionRequestActions(callback)

Example Usage



    controller.getRedemptionRequestActions(function(error, response, context) {

    
	});

Method: patchRedemptionRequest

Redeem a redemption request. After the redemption request is created it needs to be redeemed. This will deduct the amount of the advocate unclaimed balance and move the request to the completed state.

function patchRedemptionRequest(accountSlug, redemptionRequestId, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | redemptionRequestId | Required | The redemption request id |

Example Usage


    var accountSlug = account_slug;
    var redemptionRequestId = 247;

    controller.patchRedemptionRequest(accountSlug, redemptionRequestId, function(error, response, context) {

    
	});

Method: postRedemptionRequest

Create a redemption request.

function postRedemptionRequest(accountSlug, redemptionRequestForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | redemptionRequestForm | Required | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var redemptionRequestForm = new RedemptionRequestForm({"key":"value"});

    controller.postRedemptionRequest(accountSlug, redemptionRequestForm, function(error, response, context) {

    
	});

Method: getRedemptionRequest

Get a redemption request by a given id.

function getRedemptionRequest(accountSlug, redemptionRequestId, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | redemptionRequestId | Required | The redemption request identifier |

Example Usage


    var accountSlug = account_slug;
    var redemptionRequestId = redemption_request_id;

    controller.getRedemptionRequest(accountSlug, redemptionRequestId, function(error, response, context) {

    
	});

Method: getRedemptionRequests

Get the list of redemption requests.

function getRedemptionRequests(accountSlug, page, limit, filter, sort, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | page | Optional DefaultValue | Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. | | limit | Optional DefaultValue | Maximum number of results to return in the response. Default (10), threshold (100) | | filter | Optional | Allowed fields: redemption_request_id, name, lastname, email, request_status_slug, request_action_slug, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' | | sort | Optional | Allowed fields: name, lastname, email, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |

Example Usage


    var accountSlug = account_slug;
    var page = 247;
    var limit = 247;
    var filter = "filter";
    var sort = "sort";

    controller.getRedemptionRequests(accountSlug, page, limit, filter, sort, function(error, response, context) {

    
	});

Back to List of Controllers

Class: BonusesController

Get singleton instance

The singleton instance of the BonusesController class can be accessed from the API Client.

var controller = lib.BonusesController;

Method: getBonuses

Get the list of bonuses for a given account.

function getBonuses(accountSlug, page, limit, filter, sort, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | page | Optional DefaultValue | Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. | | limit | Optional DefaultValue | Maximum number of results to return in the response. Default (10), threshold (100) | | filter | Optional | Allowed fields: name, lastname, email, campaign_slug, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' | | sort | Optional | Allowed fields: name, lastname, email, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |

Example Usage


    var accountSlug = account_slug;
    var page = 247;
    var limit = 247;
    var filter = "filter";
    var sort = "sort";

    controller.getBonuses(accountSlug, page, limit, filter, sort, function(error, response, context) {

    
	});

Method: postBonus

Make an attempt to give a bonus for to the advocate's referrer. The system processes the given advocate (referral) and creates a bonus for the advocate's referrer if is needed. All restrictions set on the campaigns for this account will be check out before giving the bonus to the advocate's referrer.

function postBonus(accountSlug, bonusesForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | bonusesForm | Required | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var bonusesForm = new BonusesForm({"key":"value"});

    controller.postBonus(accountSlug, bonusesForm, function(error, response, context) {

    
	});

Method: getBonusCheckup

Check if there is a bonus to be given to the advocate. Allows the clients to check if there is a bonus to be given, it simulates the behaivor of a POST request to /accounts/{account_slug}/bonuses resource. This resource is idempotent.

function getBonusCheckup(accountSlug, advocateToken, reference, paymentAmount, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | advocateToken | Required | The referral's token. Usually the one that completed the purchase, or trigger an event. | | reference | Required | The reference number for this request. Usually the order_id, payment_id, or timestamp. | | paymentAmount | Required | The payment amount the referrals has made. Required for a percentage based campaign. |

Example Usage


    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var reference = "reference";
    var paymentAmount = 247.051445675106;

    TestHelper.getFileContents("url", function(data) {
        controller.getBonusCheckup(accountSlug, advocateToken, reference, paymentAmount, function(error, response, context) {

        });
	});

Method: postForceBonus

Force the system to give a bonus to an advocate. The system will not take into account the restriccions specified on the campaigns.

function postForceBonus(accountSlug, bonusForm, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | bonusForm | Required | The body of the request |

Example Usage


    var accountSlug = account_slug;
    var bonusForm = new ForceBonusesForm({"key":"value"});

    controller.postForceBonus(accountSlug, bonusForm, function(error, response, context) {

    
	});

Method: getBonusTrace

Get a bonus request trace.

function getBonusTrace(accountSlug, traceId, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | traceId | Required | The trace id |

Example Usage


    var accountSlug = account_slug;
    var traceId = 247;

    controller.getBonusTrace(accountSlug, traceId, function(error, response, context) {

    
	});

Method: deleteBonus

Delete a bonus

function deleteBonus(accountSlug, bonusId, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | bonusId | Required | The bonus id |

Example Usage


    var accountSlug = account_slug;
    var bonusId = 247;

    controller.deleteBonus(accountSlug, bonusId, function(error, response, context) {

    
	});

Method: getBonus

Get a bonus by a given id.

function getBonus(accountSlug, bonusId, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | bonusId | Required | The bonus id |

Example Usage


    var accountSlug = account_slug;
    var bonusId = 247;

    controller.getBonus(accountSlug, bonusId, function(error, response, context) {

    
	});

Method: getBonusTraces

Get the list of bonuses traces (audit trail). Every time the system tries to give a bonus the an advocate a new trace is created.

function getBonusTraces(accountSlug, page, limit, filter, sort, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | page | Optional DefaultValue | Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. | | limit | Optional DefaultValue | Maximum number of results to return in the response. Default (10), threshold (100) | | filter | Optional | Allowed fields: reference, result, bonus_amount, advocate_token, advocate_referrer_token, campaign_slug, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' | | sort | Optional | Allowed fields: created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |

Example Usage


    var accountSlug = account_slug;
    var page = 247;
    var limit = 247;
    var filter = "filter";
    var sort = "sort";

    controller.getBonusTraces(accountSlug, page, limit, filter, sort, function(error, response, context) {

    
	});

Back to List of Controllers

Class: CampaignsController

Get singleton instance

The singleton instance of the CampaignsController class can be accessed from the API Client.

var controller = lib.CampaignsController;

Method: getCampaign

Get a campaign by a given slug.

function getCampaign(accountSlug, campaignSlug, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | campaignSlug | Required | The campaign identifier |

Example Usage


    var accountSlug = account_slug;
    var campaignSlug = campaign_slug;

    controller.getCampaign(accountSlug, campaignSlug, function(error, response, context) {

    
	});

Method: getCampaigns

Get the list of campaings for a given account.

function getCampaigns(accountSlug, page, limit, filter, sort, callback)

Parameters

| Parameter | Tags | Description | |-----------|------|-------------| | accountSlug | Required | The account identifier | | page | Optional DefaultValue | Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. | | limit | Optional DefaultValue | Maximum number of results to return in the response. Default (10), threshold (100) | | filter | Optional | Allowed fields: name, description, start_date, end_date, is_active (true|false), created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' | | sort | Optional | Allowed fields: campaign_slug, created, start_date, end_date, is_active. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |

Example Usage


    var accountSlug = account_slug;
    var page = 247;
    var limit = 247;
    var filter = "filter";
    var sort = "sort";

    controller.getCampaigns(accountSlug, page, limit, filter, sort, function(error, response, context) {

    
	});

Back to List of Controllers