appnet v0.6.0
appnet.js
A library for interacting with app.net written in JavaScript. Exported as both a jQuery and a Node.js module.
In jQuery, every method is invoked from the object found at $.appnet. Using Node.js, that object is the sole export. See the examples below.
Most function map one-to-one onto the HTTP endpoints of the app.net API. The exceptions are a few utility functions at the top level for setting and checking authorization tokens, and the all.* functions which are a convenient way to get an entire stream.
Download
When using this package with jQuery, the current release can be found at:
The latest development version can be obtained at:
If you wish to use this as a Node.js module, install it using npm:
JQuery Example
Node.js Example
Reference
Utility Functions
'all' endpoints
$.appnet.all provides some convenience functions for fetching the contents of an entire stream, automatically using pagination parameters to make multiple calls to the API when necessary.
Caution These functions will keep calling and not callback until the entire stream is fetched. If the stream is big, this can be a long wait. Only use these when you are confident that the stream can be fetched with a few calls.
These functions all return a mock response envelope with a 'data' field containing an array of the entire set of objects fetched. If they fail part of the way through, your rejection method will be called with the failed response object.
app.net endpoints
These endpoints all return the result of invoking $.ajax() which is a jQuery promise. You are then free to attach your own callbacks to it etc. Typically the response you receive will be a response envelope with a 'data' field containing the results of your operation on success and a 'meta' field with the response code and any other information associated with your query.
File upload needs tested and may need a special case.