Node.js Wrapper for Meerkat API
This is a Node.js implementation of a wrapper for communicating with the Meerkat API.
Installation Instructions
npm install --save meerkat-api
Features
- There are two ways to use it:
- Callbacks: All methods take an optional callback function. The callback is called with two arguments: an error (or null if the operation succeeded) and an object containing the API data.
- Promises: If you don't supply a callback function, a Promise will be returned. If the operation completes successfully, the promise is resolved with the returned API data. If the operation fails, the promise is rejected with an error.
- Periodically queries Meerkat's Routing Map and modifies the API endpoints if they change.
Usage
var Meerkat = ; // Create an instance.var meerkat = API_TOKEN;// You can get an API token here: http://developers.meerkatapp.co/api/ /** * General requests. */ // Callback style:meerkat; // Promise style:meerkat ; // Callback style:meerkat; // Promise style:meerkat ; /** * Broadcast-specific requests. */var broadcastId = '6a4da7ba-20f5-4f0d-81de-e5cf37b3072b'; meerkat; meerkat ; meerkat; meerkat ; meerkat; meerkat ; meerkat; meerkat ; meerkat; meerkat ; meerkat; meerkat ; /** * User-specific requests. */var userId = '54fb2e454d0000d23bb9c40f'; meerkat; meerkat ; /** * Don't forget to clean up when exiting. */process;process; { // Don't accept any more requests. Finish handling the current requests. server;}