0.4.14 • Published 7 years ago

habitat-client-node v0.4.14

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

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

0.4.14

7 years ago

0.4.13

7 years ago

0.4.12

7 years ago

0.4.11

7 years ago

0.4.10

7 years ago

0.4.9

7 years ago

0.4.82

7 years ago

0.4.81

7 years ago

0.4.8

7 years ago

0.4.7

7 years ago

0.4.41

7 years ago

0.4.6

7 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.1

7 years ago

0.2.25

7 years ago

0.3.0

7 years ago

0.2.24

7 years ago

0.2.23

7 years ago

0.2.22

7 years ago

0.2.21

7 years ago

0.2.20

7 years ago

0.2.19

7 years ago

0.2.18

7 years ago

0.2.17

7 years ago

0.2.16

7 years ago

0.2.15

7 years ago

0.2.14

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago