dispatch-client
v0.1.6
Published
Universal javascript client for the Dispatch API
Downloads
27
Readme
dispatch-client
Universal javascript client for the Dispatch API.
Installation
npm install dispatch-client
API Overview
Every resource is accessed via your dispatch
instance:
const dispatch = new require('dispatch-client')({ clientId, clientSecret });
// dispatch.{ RESOURCE_NAME }.{ METHOD_NAME }
Every resource method returns a promise:
dispatch.events.get({ jobId: '123' }).then(events => {
console.log('Job events', events);
});
Resources & methods
- dispatch
- attachments
get(selector, [options])
-dispatch.attachments.get({ jobId: '1' })
create(doc, [options])
-dispatch.attachments.create({ jobId: '1', fileToken: 'filetoken' })
- events
get(selector, [options])
-dispatch.events.get({ jobId: '1'})
create(doc, [options])
-dispatch.events.create({ jobId: '1', message: 'Friendly dog at the house' })
- files
url(token)
-dispatch.files.url('filetoken')
fetch(path, [options])
-dispatch.fetch('v1/jobs')
getToken([options])
-dispatch.getToken()
momentTimezone(timezone)
-dispatch.momentTimezone('Hawaii')