anedot-api
v0.0.2
Published
A simple promise based client to interact with the anedote api
Downloads
2
Keywords
Readme
Anedot Api
This package offers a simple abstraction of the anedot v2 api
Installation
npm install --save anedot-api
Usage
In order to use utilise this package, you must first instantiate the api which can be done like so:
var AnedotApi = require('anedot-api').AnedotApi;
var anedotClient = new AnedotApi({ apiKey: anedotApiKey, email: anedotEmail });
Where anedotApiKey and anedotEmail correspond to your anedot api key and email respectively
Api Usage
getCampaignList
This method returns a list of all campaigns associated with the user account.
getCampaignDetails(campainId)
This method returns the values of a campaign specified by campaignId.
getCampaignTotalRaised(campainId)
This method returns the goal for the campaign, the total amount raised for the campaign in dollars, the percentage of the goal raised and the percentage remaining.
getDonationList(campainId)
This method returns a list of donations ordered from newest to oldest.
getDonation(number)
This method returns the values of a donation specified by number.
getAccountList
This method returns a list of all accessible organization accounts.
All methods return a promise and are therefore chainable like so
anedotClient.getCampainList()
.then(function(campaignList) {
var firstCampaignId = campaignList[0].uid;
return anedotClient.getCampaignDetails(firstCampainId);
})
.then(function(campaignDetails) {
console.log(campaignDetails);
});