Skip to content

gridwise/hypertrack-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HyperTrack Node Bindings

Build Status Coverage Status npm version Slack Status

A javascript wrapper for the HyperTrack api.

Installation

npm install hypertrack

Usage

You'll need your hypertrack secret key. You can find this from your account page. To start using, you can do the following:

var hypertrack = require('hypertrack')('<YOUR HYPERTRACK SECRET KEY>');
// hypertrack.{ RESOURCE_NAME }.{ METHOD_NAME }

Every resource method accepts an optional callback as the last argument:

hypertrack.users.create(
    { name: 'Tapan Pandita', phone: '+16502469293' },
    function(err, user) {
        err; // null if no error occurred
        user; // the created user object
    }
);

Additionally, every resource method returns a promise, so you don't have to use the regular callback. E.g.

// Create a new customer and then a new destination for that customer:
hypertrack.users.create({
  name: 'Tapan Pandita',
  phone: '+16502469293'
}).then(function(user) {
  hypertrack.users.assign_actions(user.id, {"action_ids": ["123e4567-e89b-12d3-a456-426655440000"]})
}).catch(function(err) {
  // Deal with an error
});

Documentation

For detailed documentation of the methods available, please visit the official HyperTrack API documentation.

Testing

Run the tests using npm:

$ npm install
$ npm test

About

HyperTrack node.js bindings

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%