Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

habitat-client-node

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

habitat-client-node

An axios-powered client wrapper for the Habitat API

  • 0.4.14
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

habitat-client-node

An axios-powered client wrapper for the Habitat API

Habitat Node wrapper

Getting Started

npm i habitat-client-node

or for meteor folks...

meteor npm install habitat-client-node

Prerequisites

You'll need an API Key - contact us at developers@tryhabitat.com to get started!

Initialize connection

  • Initialize client and login
const client = new Habitat({
  baseUrl: "https://sandbox.tryhabitat.com",
  apiKey: "YOUR_API_KEY"
});

//Returns a session token if it wasn't passed into constructor
client.login({
  email: "yourusername@tryhabitat.com",
  password: "password"
})
.then((token) => {
  //set token in localStorage, etc...
});

Send an order to dispatch

  client.create({
      sellerId: sellerId,
      thirdParty: false,
      deliveryAddress: address,
      deliveryInstructions: instructions,
      customer: { phone, name },
      DaaSType: type
  })

Transaction lifecycle methods

  • Call transaction lifecycle methods, super easy and all return a promise.
  //accept an order (Admin / Vendor)

  client.accept(orderId).then((order) => {

      //what would be helpful to return here?

  })

  //assign a runner (Admin / Vendor)

  client.assign(orderId, {
     runnerId: runnerId
  }).then((order) => {

     //what would be helpful to return here?

  })

  //pickup an order (Admin / Runner)
  client.pickup(orderId).then((order) => {

      //what would be helpful to return here?

  })

  //dropoff an order (Admin / Runner)

  client.dropoff(orderId, {
    tip: 4.20,
    receiptUrl: https://placekitten.com/50/50
  }).then((order) => {

      //what would be helpful to return here?

   })

Built With

  • Axios - Promise-based HTTP client

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning.

Authors

  • Mike Paszkiewicz - Initial work - MikeP

License

This project is licensed under the MIT License - see the LICENSE.md file for details

FAQs

Package last updated on 10 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc