No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
geniusreferralslib
LICENSE
README.md

README.md

Getting started

How to Build

The generated SDK requires AngularJS framework to work. If you do not already have angular downloaded, please go ahead and do it from here

How to Use

The following section describes how to use the generated SDK in an existing/new project.

1. Configure Angular and Generated SDK

Perform the following steps to configure angular and the SDK:

  • Make a scripts folder inside the root folder of the project. If you already have a scripts folder, skip to the next step.
  • Move the angular.min.js file inside the scripts folder.
  • Move the geniusreferralslib folder inside the scripts folder.

folder-structure-image

2. 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

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-folder-image

3. Create an Angular Application

Since Angular JS is used for client-side web development, in order to use the generated library, you will have to develop an application first. If you already have an angular application, skip to Step 6. Otherwise, follow these steps to create one:

  • In the IDE, click on File and choose New File to create a new file.
  • Add the following starting code in the file:
    var app = angular.module('myApp', []);
    app.controller('testController', function($scope) 
    {

    });
  • Save it with the name app.js in the scripts folder.

4. Create HTML File

Skip to the next step if you are working with an existing project and already have an html file. Otherwise follow the steps to create one:

  • Inside the IDE, right click on the project folder name and select the New File option to create a new test file.
  • Save it with an appropriate name such as index.html in the root of your project folder. index.html should look like this:
	<!DOCTYPE html>
	<html>
	<head>
		<title>Angular Project</title>
		<script></script>
	</head>

	<body>
	</body>

	</html>

initial-html-code-image

5. Including links to Angular in HTML file

Your HTML file needs to have a link to angular.min.js file to use Angular-JS. Add the link using script tags inside the head section of index.html like:

	<script src="scripts/angular.min.js" ></script>

6. Include SDK references in HTML file

Import the reference to the generated SDK files inside your html file like:

	<head>
		...
		<!-- Helper files -->
		<script src="scripts/geniusreferralslib/Configuration.js"></script>
		<script src="scripts/geniusreferralslib/APIHelper.js"></script>
		<script src="scripts/geniusreferralslib/Http/Client/HttpContext.js"></script>
		<script src="scripts/geniusreferralslib/Http/Client/RequestClient.js"></script>
		<script src="scripts/geniusreferralslib/Http/Request/HttpRequest.js"></script>
		<script src="scripts/geniusreferralslib/Http/Response/HttpResponse.js"></script>

		<!-- API Controllers -->
        <script src="scripts/geniusreferralslib/Controllers/RootsController.js"></script>
        <script src="scripts/geniusreferralslib/Controllers/AuthenticationsController.js"></script>
        <script src="scripts/geniusreferralslib/Controllers/AdvocatesController.js"></script>
        <script src="scripts/geniusreferralslib/Controllers/AccountsController.js"></script>
        <script src="scripts/geniusreferralslib/Controllers/ReportsController.js"></script>
        <script src="scripts/geniusreferralslib/Controllers/ReferralsController.js"></script>
        <script src="scripts/geniusreferralslib/Controllers/RedemptionRequestsController.js"></script>
        <script src="scripts/geniusreferralslib/Controllers/BonusesController.js"></script>
        <script src="scripts/geniusreferralslib/Controllers/CampaignsController.js"></script>


		<!-- Models -->
        <script src="scripts/geniusreferralslib/Models/BaseModel.js"></script>
        <script src="scripts/geniusreferralslib/Models/Advocate.js"></script>
        <script src="scripts/geniusreferralslib/Models/AdvocateForm.js"></script>
        <script src="scripts/geniusreferralslib/Models/AdvocatePatchForm.js"></script>
        <script src="scripts/geniusreferralslib/Models/Bonuses.js"></script>
        <script src="scripts/geniusreferralslib/Models/BonusesForm.js"></script>
        <script src="scripts/geniusreferralslib/Models/ForceBonuses.js"></script>
        <script src="scripts/geniusreferralslib/Models/ForceBonusesForm.js"></script>
        <script src="scripts/geniusreferralslib/Models/RedemptionRequest.js"></script>
        <script src="scripts/geniusreferralslib/Models/RedemptionRequestForm.js"></script>
        <script src="scripts/geniusreferralslib/Models/Referral.js"></script>
        <script src="scripts/geniusreferralslib/Models/ReferralForm.js"></script>
        <script src="scripts/geniusreferralslib/Models/PaymentMethod.js"></script>
        <script src="scripts/geniusreferralslib/Models/PaymentMethodForm.js"></script>

		...
	</head>

The Configuration.js file should be imported before the other files.

7. Including link to app.js in HTML file

Link your app.js file to your index.html file like:

	<head>
		...
		<script src="scripts/app.js"></script>
	</head>

The link to app.js needs to be included at the very end of the head tag, after the SDK references have been added

8. Initializing the Angular App

You need to initialize your app and the controller associated with your view inside your index.html file. Do so like:

  • Add ng-app directive to initialize your app inside the body tag.
	<body ng-app="myApp">
  • Add ng-controller directive to initialize your controller and bind it with your view (index.html file).
	...
	<body ng-app="myApp">
		<div ng-controller="testController">
			...
		</div>
		...
	</body>
	...

9. Consuming the SDK

In order to use the generated SDK's modules, controllers and factories, the project needs to be added as a dependency in your angular app's module. This will be done inside the app.js file. Add the dependency like this:

    var app = angular.module('myApp', ['GeniusReferralsLib']);

At this point, the SDK has been successfully included in your project. Further steps include using a service/factory from the generated SDK. To see working example of this, please head on over here and choose any class to see its functions and example usage.

10. Running The App

To run the app, simply open up the index.html file in a browser.

app-running

Class Reference

List of Controllers

Class: RootsController

Get singleton instance

The singleton instance of the RootsController class can be accessed via Dependency Injection.

	app.controller("testController", function($scope, RootsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	});

Method: getRoot

The root of the API

function getRoot()

Example Usage

	app.controller("testController", function($scope, RootsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	

		var result = RootsController.getRoot();
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Back to List of Controllers

Class: AuthenticationsController

Get singleton instance

The singleton instance of the AuthenticationsController class can be accessed via Dependency Injection.

	app.controller("testController", function($scope, AuthenticationsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	});

Method: getAuthentication

Allow clients to test authentication on Genius Referrals platform.

function getAuthentication()

Example Usage

	app.controller("testController", function($scope, AuthenticationsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	

		var result = AuthenticationsController.getAuthentication();
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Back to List of Controllers

Class: AdvocatesController

Get singleton instance

The singleton instance of the AdvocatesController class can be accessed via Dependency Injection.

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	});

Method: deleteAdvocate

Delete an advocate

function deleteAdvocate(accountSlug, advocateToken)

Parameters

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

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;


		var result = AdvocatesController.deleteAdvocate(accountSlug, advocateToken);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: putAdvocate

Update an advocate.

function putAdvocate(accountSlug, advocateToken, advocateForm)

Parameters

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

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocateForm = new AdvocateForm({"key":"value"});


		var result = AdvocatesController.putAdvocate(accountSlug, advocateToken, advocateForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: postAdvocate

Create a new advocate.

function postAdvocate(accountSlug, advocateForm)

Parameters

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

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateForm = new AdvocateForm({"key":"value"});


		var result = AdvocatesController.postAdvocate(accountSlug, advocateForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getAdvocate

Get an advocate by a given token.

function getAdvocate(accountSlug, advocateToken)

Parameters

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

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;


		var result = AdvocatesController.getAdvocate(accountSlug, advocateToken);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: deleteAdvocates

Delete all advocates

function deleteAdvocates(accountSlug)

Parameters

Parameter Tags Description
accountSlug Required The account identifier

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;


		var result = AdvocatesController.deleteAdvocates(accountSlug);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getAdvocates

Get the list of advocates

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

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

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var page = 132;
    var limit = 132;
    var filter = "filter";
    var sort = "sort";


		var result = AdvocatesController.getAdvocates(accountSlug, page, limit, filter, sort);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: patchAdvocate

Update partial elements of an advocate.

function patchAdvocate(accountSlug, advocateToken, advocatePatchForm)

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

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocatePatchForm = [{"key":"value"}].map(function(elem) {
        return new Advocate Patch Form(elem);
    });


		var result = AdvocatesController.patchAdvocate(accountSlug, advocateToken, advocatePatchForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

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)

Parameters

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

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;


		var result = AdvocatesController.getShareLinks(accountSlug, advocateToken);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: putPaymentMethod

Update a payment method.

function putPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodId, advocatePaymentMethodForm)

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

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocatePaymentMethodId = 132;
    var advocatePaymentMethodForm = new PaymentMethodForm({"key":"value"});


		var result = AdvocatesController.putPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodId, advocatePaymentMethodForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getPaymentMethod

Get an advocate's payment method

function getPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodId)

Parameters

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

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocatePaymentMethodId = 132;


		var result = AdvocatesController.getPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodId);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: postPaymentMethod

Create a new payment method.

function postPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodForm)

Parameters

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

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var advocatePaymentMethodForm = new PaymentMethodForm({"key":"value"});


		var result = AdvocatesController.postPaymentMethod(accountSlug, advocateToken, advocatePaymentMethodForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getBonusRedemptionMethod

Get bonuses redemption method.

function getBonusRedemptionMethod(bonusesRedemptionMethodSlug)

Parameters

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

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var bonusesRedemptionMethodSlug = bonuses_redemption_method_slug;


		var result = AdvocatesController.getBonusRedemptionMethod(bonusesRedemptionMethodSlug);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getBonusRedemptionMethods

Get bonuses redemption methods.

function getBonusRedemptionMethods()

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	

		var result = AdvocatesController.getBonusRedemptionMethods();
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getCurrencies

Get currencies.

function getCurrencies()

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	

		var result = AdvocatesController.getCurrencies();
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getCurrency

Get a currency.

function getCurrency(code)

Parameters

Parameter Tags Description
code Required The currency's code

Example Usage

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var code = "code";


		var result = AdvocatesController.getCurrency(code);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getPaymentMethods

Get the advocate's payment methods.

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

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

	app.controller("testController", function($scope, AdvocatesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var page = 132;
    var limit = 132;
    var filter = "filter";
    var sort = "sort";


		var result = AdvocatesController.getPaymentMethods(accountSlug, advocateToken, page, limit, filter, sort);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Back to List of Controllers

Class: AccountsController

Get singleton instance

The singleton instance of the AccountsController class can be accessed via Dependency Injection.

	app.controller("testController", function($scope, AccountsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	});

Method: getAccount

Get an account by a given slug.

function getAccount(accountSlug)

Parameters

Parameter Tags Description
accountSlug Required The account identifier

Example Usage

	app.controller("testController", function($scope, AccountsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;


		var result = AccountsController.getAccount(accountSlug);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getAccounts

Get the list of accounts.

function getAccounts(page, limit, filter, sort)

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

	app.controller("testController", function($scope, AccountsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var page = 132;
    var limit = 132;
    var filter = "filter";
    var sort = "sort";


		var result = AccountsController.getAccounts(page, limit, filter, sort);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Back to List of Controllers

Class: ReportsController

Get singleton instance

The singleton instance of the ReportsController class can be accessed via Dependency Injection.

	app.controller("testController", function($scope, ReportsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	});

Method: getReferralsSummaryPerOrigin

Get referrals summary per referral origin.

function getReferralsSummaryPerOrigin(advocateToken)

Parameters

Parameter Tags Description
advocateToken Required The advocate's token

Example Usage

	app.controller("testController", function($scope, ReportsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var advocateToken = advocate_token;


		var result = ReportsController.getReferralsSummaryPerOrigin(advocateToken);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getBonusesSummaryPerOrigin

Get bonuses summary per referral origin.

function getBonusesSummaryPerOrigin(advocateToken)

Parameters

Parameter Tags Description
advocateToken Required The advocate's token

Example Usage

	app.controller("testController", function($scope, ReportsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var advocateToken = advocate_token;


		var result = ReportsController.getBonusesSummaryPerOrigin(advocateToken);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getTopAdvocates

Get top 10 advocates.

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

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

	app.controller("testController", function($scope, ReportsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var campaignSlug = campaign_slug;
    var limit = 132;
    var from = date("D M d, Y G:i");
    var to = date("D M d, Y G:i");


		var result = ReportsController.getTopAdvocates(accountSlug, campaignSlug, limit, from, to);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getShareDailyParticipation

Get share daily participation.

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

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

	app.controller("testController", function($scope, ReportsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    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");


		var result = ReportsController.getShareDailyParticipation(accountSlug, campaignSlug, advocateToken, from, to);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getReferralDailyParticipation

Get referral daily participation.

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

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

	app.controller("testController", function($scope, ReportsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    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");


		var result = ReportsController.getReferralDailyParticipation(accountSlug, campaignSlug, advocateToken, from, to);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getClickDailyParticipation

Get click daily participation.

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

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

	app.controller("testController", function($scope, ReportsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    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");


		var result = ReportsController.getClickDailyParticipation(accountSlug, campaignSlug, advocateToken, from, to);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getBonusesDailyGiven

Get bonuses daily given.

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

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

	app.controller("testController", function($scope, ReportsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    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");


		var result = ReportsController.getBonusesDailyGiven(accountSlug, campaignSlug, advocateToken, from, to);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Back to List of Controllers

Class: ReferralsController

Get singleton instance

The singleton instance of the ReferralsController class can be accessed via Dependency Injection.

	app.controller("testController", function($scope, ReferralsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	});

Method: getReferralOrigin

Get a referral origin by a given slug.

function getReferralOrigin(referralOriginSlug)

Parameters

Parameter Tags Description
referralOriginSlug Required The referral origin identifier

Example Usage

	app.controller("testController", function($scope, ReferralsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var referralOriginSlug = referral_origin_slug;


		var result = ReferralsController.getReferralOrigin(referralOriginSlug);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

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()

Example Usage

	app.controller("testController", function($scope, ReferralsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	

		var result = ReferralsController.getReferralOrigins();
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getReferral

Get a referral by a given id.

function getReferral(accountSlug, advocateToken, referralId)

Parameters

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

Example Usage

	app.controller("testController", function($scope, ReferralsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var referralId = referral_id;


		var result = ReferralsController.getReferral(accountSlug, advocateToken, referralId);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: deleteReferral

Delete a referral.

function deleteReferral(accountSlug, advocateToken, referralId)

Parameters

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

Example Usage

	app.controller("testController", function($scope, ReferralsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var referralId = referral_id;


		var result = ReferralsController.deleteReferral(accountSlug, advocateToken, referralId);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: postReferral

Create a new referral.

function postReferral(accountSlug, advocateToken, referralForm)

Parameters

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

Example Usage

	app.controller("testController", function($scope, ReferralsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var referralForm = new ReferralForm({"key":"value"});


		var result = ReferralsController.postReferral(accountSlug, advocateToken, referralForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: putReferral

Update a referral.

function putReferral(accountSlug, advocateToken, referralId, referralForm)

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

	app.controller("testController", function($scope, ReferralsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var referralId = referral_id;
    var referralForm = new ReferralForm({"key":"value"});


		var result = ReferralsController.putReferral(accountSlug, advocateToken, referralId, referralForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getReferrals

Get the list of referrals for a given advocate.

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

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

	app.controller("testController", function($scope, ReferralsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var page = 132;
    var limit = 132;
    var filter = "filter";
    var sort = "sort";


		var result = ReferralsController.getReferrals(accountSlug, advocateToken, page, limit, filter, sort);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Back to List of Controllers

Class: RedemptionRequestsController

Get singleton instance

The singleton instance of the RedemptionRequestsController class can be accessed via Dependency Injection.

	app.controller("testController", function($scope, RedemptionRequestsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	});

Method: getRedemptionRequestStatus

Get a redemption request status.

function getRedemptionRequestStatus(redemptionRequestStatusSlug)

Parameters

Parameter Tags Description
redemptionRequestStatusSlug Required The redemption request status identifier

Example Usage

	app.controller("testController", function($scope, RedemptionRequestsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var redemptionRequestStatusSlug = redemption_request_status_slug;


		var result = RedemptionRequestsController.getRedemptionRequestStatus(redemptionRequestStatusSlug);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getRedemptionRequestStatuses

Get redemption request statuses.

function getRedemptionRequestStatuses()

Example Usage

	app.controller("testController", function($scope, RedemptionRequestsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	

		var result = RedemptionRequestsController.getRedemptionRequestStatuses();
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getRedemptionRequestAction

Get a redemption request action.

function getRedemptionRequestAction(redemptionRequestActionSlug)

Parameters

Parameter Tags Description
redemptionRequestActionSlug Required The redemption request action identifier

Example Usage

	app.controller("testController", function($scope, RedemptionRequestsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var redemptionRequestActionSlug = redemption_request_action_slug;


		var result = RedemptionRequestsController.getRedemptionRequestAction(redemptionRequestActionSlug);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getRedemptionRequestActions

Get redemption request actions.

function getRedemptionRequestActions()

Example Usage

	app.controller("testController", function($scope, RedemptionRequestsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	

		var result = RedemptionRequestsController.getRedemptionRequestActions();
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

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)

Parameters

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

Example Usage

	app.controller("testController", function($scope, RedemptionRequestsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var redemptionRequestId = 132;


		var result = RedemptionRequestsController.patchRedemptionRequest(accountSlug, redemptionRequestId);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: postRedemptionRequest

Create a redemption request.

function postRedemptionRequest(accountSlug, redemptionRequestForm)

Parameters

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

Example Usage

	app.controller("testController", function($scope, RedemptionRequestsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var redemptionRequestForm = new RedemptionRequestForm({"key":"value"});


		var result = RedemptionRequestsController.postRedemptionRequest(accountSlug, redemptionRequestForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getRedemptionRequest

Get a redemption request by a given id.

function getRedemptionRequest(accountSlug, redemptionRequestId)

Parameters

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

Example Usage

	app.controller("testController", function($scope, RedemptionRequestsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var redemptionRequestId = redemption_request_id;


		var result = RedemptionRequestsController.getRedemptionRequest(accountSlug, redemptionRequestId);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getRedemptionRequests

Get the list of redemption requests.

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

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

	app.controller("testController", function($scope, RedemptionRequestsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var page = 132;
    var limit = 132;
    var filter = "filter";
    var sort = "sort";


		var result = RedemptionRequestsController.getRedemptionRequests(accountSlug, page, limit, filter, sort);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Back to List of Controllers

Class: BonusesController

Get singleton instance

The singleton instance of the BonusesController class can be accessed via Dependency Injection.

	app.controller("testController", function($scope, BonusesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	});

Method: getBonuses

Get the list of bonuses for a given account.

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

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

	app.controller("testController", function($scope, BonusesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var page = 132;
    var limit = 132;
    var filter = "filter";
    var sort = "sort";


		var result = BonusesController.getBonuses(accountSlug, page, limit, filter, sort);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

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)

Parameters

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

Example Usage

	app.controller("testController", function($scope, BonusesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var bonusesForm = new BonusesForm({"key":"value"});


		var result = BonusesController.postBonus(accountSlug, bonusesForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

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)

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

	app.controller("testController", function($scope, BonusesController, $http,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var advocateToken = advocate_token;
    var reference = "reference";
    var paymentAmount = 132.655736781962;


		$http.get().then(function(successData){
            file = successData;
            var result = BonusesController.getBonusCheckup(accountSlug, advocateToken, reference, paymentAmount);
        //Function call returns a promise
            result.then(function(success){
    			//success case
    			//getting context of response
    			console.log(success.getContext());
    		},function(err){
    			//failure case
    		});
    
    	}, function(errorData){
    
    	});
	});

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)

Parameters

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

Example Usage

	app.controller("testController", function($scope, BonusesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var bonusForm = new ForceBonusesForm({"key":"value"});


		var result = BonusesController.postForceBonus(accountSlug, bonusForm);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getBonusTrace

Get a bonus request trace.

function getBonusTrace(accountSlug, traceId)

Parameters

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

Example Usage

	app.controller("testController", function($scope, BonusesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var traceId = 132;


		var result = BonusesController.getBonusTrace(accountSlug, traceId);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: deleteBonus

Delete a bonus

function deleteBonus(accountSlug, bonusId)

Parameters

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

Example Usage

	app.controller("testController", function($scope, BonusesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var bonusId = 132;


		var result = BonusesController.deleteBonus(accountSlug, bonusId);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getBonus

Get a bonus by a given id.

function getBonus(accountSlug, bonusId)

Parameters

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

Example Usage

	app.controller("testController", function($scope, BonusesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var bonusId = 132;


		var result = BonusesController.getBonus(accountSlug, bonusId);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

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)

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

	app.controller("testController", function($scope, BonusesController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var page = 132;
    var limit = 132;
    var filter = "filter";
    var sort = "sort";


		var result = BonusesController.getBonusTraces(accountSlug, page, limit, filter, sort);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Back to List of Controllers

Class: CampaignsController

Get singleton instance

The singleton instance of the CampaignsController class can be accessed via Dependency Injection.

	app.controller("testController", function($scope, CampaignsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	});

Method: getCampaign

Get a campaign by a given slug.

function getCampaign(accountSlug, campaignSlug)

Parameters

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

Example Usage

	app.controller("testController", function($scope, CampaignsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var campaignSlug = campaign_slug;


		var result = CampaignsController.getCampaign(accountSlug, campaignSlug);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Method: getCampaigns

Get the list of campaings for a given account.

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

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

	app.controller("testController", function($scope, CampaignsController,Advocate,AdvocateForm,AdvocatePatchForm,Bonuses,BonusesForm,ForceBonuses,ForceBonusesForm,RedemptionRequest,RedemptionRequestForm,Referral,ReferralForm,PaymentMethod,PaymentMethodForm){
	    var accountSlug = account_slug;
    var page = 90;
    var limit = 90;
    var filter = "filter";
    var sort = "sort";


		var result = CampaignsController.getCampaigns(accountSlug, page, limit, filter, sort);
        //Function call returns a promise
        result.then(function(success){
			//success case
			//getting context of response
			console.log(success.getContext());
		},function(err){
			//failure case
		});

	});

Back to List of Controllers