This SDK provides the ability to communicate both with the Robin API and the Robin Grid.
npm install firstname.lastname@example.org:robinpowered/robin-js-sdk.git --save will save this to the
dependencies section of your
You may then
sdk as follows:
var Robin = require('robin-js-sdk');
Include the script from
$version is the npm version number in
robin-js-sdk will be automatically attached to the
window object as
robin-js-sdk is instantiated with two arguments, the first is a Robin Access Token. The second is an optional argument that can be
If the second argument is
SDK will be instantiated with endpoints pointing to
If it is a string, it must be a valid
robin endpoint. Valid values are
production. Otherwise an error is thrown.
If it is an object:
- An empty object will result in all endpoints defaulting to production.
- If it contains an
envproperty, all endpoints will default to that env. Values other than string types for this property will throw errors.
- If it has a
urlsproperty, then values for
placeswill override the default endpoint for any of those apps. Types for this property other than
objectwill throw errors. Properties of this object other than
placeswill throw errors.
The Robin API is a REST based API. Calls to the API return a
Core API Routes:
Places API Routes:
<sub>TODO: Improve this section in a future PR</sub>
The Grid is a websocket server that allows PubSub between clients and devices through configured channels. The Grid module is an
EventEmitter, to allow real-time updates.
The Grid exposes several modules, which allow you to connect and listen:
join- Allows clients to listen to updates from channels
leave- Disconnects the client from receiving updates for a particular channel
send- Allows a client to send messages to a channel.
The following should be implemented:
- [x] Support for use in browsers, as well as node.js
[ ] Add winston for logging - will this work in browsers?
- [x] Handle scope of access tokens for extended functionality (such as retrieving all API items)
- [x] Implement API function arguments based on API documentation
- [ ] Expand documentation to include all API modules
- [ ] Can we autogenerate API module functions based on a object template?
grunt browser generates two files in the
browser/robin.browser.jsis the full file after being run through browserify.
browser/robin.browser.min.jsis the minified version.