Skip to content

Community Application: Charities

NateFerrero edited this page Sep 25, 2011 · 5 revisions

Community Application: Charities

List of Charities

Code:

e.app.community.charities( function(err, charities) {
    charities.forEach( function(charity) {
        // Do something with each charity here
    } );
} );

Returned Values for variable charities:

Variable Contents Description
charities.items [Charity, Charity, ...] Array of charities, up to the amount per page (default 10).
charities._next Function Call this to load the next page of charities automatically.
charities._prev Function Call this to load the previous page of charities automatically.
charities._page(page) Function Call this to load a specific page of charities automatically.
charities.count 10 The number of charities on the current page.
charities.paging Object
  • has_next: true
  • has_prev: false
  • items: 100
  • length: 10
  • page: 1
  • pages: 10
Paging information
  • Is there a next page?
  • Is there a previous page?
  • Total items in the list.
  • Length of a single page
  • Current page number.
  • How many pages there are.

Single Charity

Code:

e.app.community.charity(43, function(err, charity) {
    // Do something with the charity here
} );

Get an individual charity like that, or using the list as previously demonstrated.

Returned Values for variable charity:

Variable Contents Description
charity.id 43 ID of the charity.
charity.name Hope International Name of the charity.
charity.description Hope International was founded in 1993 to help combat global poverty. Short description of the charity.
charity.href //live58.donate.io/momentum/charity/43 URL of the charity page.
charity.link <a href="http://live58.donate.io/momentum/charity/43">Hope International</a> HTML link to the charity page.
charity.progress 1260.00 Progress of all current projects in dollars.
charity.target 3500.00 Target of all current projects in dollars.
charity.photo /portal/photo/charity/43 A URL containing the location of the charity photo.
charity.project(callback) Project Contains the most recent project associated with the charity. See the Projects API Reference for more details.
charity.projects(callback) [Project, Project, ...] Contains all of the projects associated with the charity. See the Projects API Reference for more details.
Clone this wiki locally