Skip to content

Actions Application: Items

NateFerrero edited this page Sep 22, 2011 · 1 revision

Actions Application: Items

List of Action Items

Code:

e.app.actions.items( function(err, items) {
    items.forEach( function(item) {
        // Do something with each action item here
    } );
} );

Returned Values for variable items:

Variable Contents Description
items.items [Item, Item, ...] Array of action items, up to the amount per page (default 10).
items._next Function Call this to load the next page of action items automatically.
items._prev Function Call this to load the previous page of action items automatically.
items._page(page) Function Call this to load a specific page of action items automatically.
items.count 10 The number of action items on the current page.
items.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 Action Item

Code:

e.app.actions.item(43, function(err, item) {
    // Do something with the action item here
} );

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

Returned Values for variable item:

Variable Contents Description
item.id 43 ID of the action item.
item.description Watch the introduction video. Short description of the action item.
item.message Learn more about living 58 Message displayed when completing the action.
item.type link Type of the action item.
item.url /momentum/intro URL of the action item.
item.points 10 How many points the action item is worth.
item.ticks 5 Action item tick (number of completions) count.
item.completed false True only if a user is logged in and has completed the action item.
Clone this wiki locally