1.0.0 • Published 6 years ago

hatchbaby v1.0.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
6 years ago

hatchbaby

Unofficial JavaScript REST API client for the Hatch Baby app

Build Status Coverage Status Greenkeeper

This is not an official library by Hatch Baby, Inc. I’m just a dad with unforeseen scalability problems – so now I’m into #babyops.

Example

const client = new HatchBaby ({
  auth: {
    email: 'me@example.com',
    password: 'secret'
  }
})

await client.pumping.create({
  amount: 200 // always in ml
})

API

Custom Request

If an API was not implemented yet you can use the client.request method to send your custom request.

const data = await client.request({
  method: 'POST' // defaults to GET
  path: '/service/app/pumping/v2/create',
  body: {
    amount: 350,
    side: 'Both',
    startTime: '2018-08-05 09:33:00'
  }
})

Pumping

Create

client.pumping.create(options)

Example

const {payload: {id}} = await client.pumping.create({
  amount: 200 // always in ml
})
console.log(`New pumping session created (#${id})`)

List

client.pumping.list()

No arguments. Example:

const {payload: {pumpings}} = await client.pumping.list()
console.log(`${pumpings.length} pumping sessions recorded`)

Delete

client.pumping.delete(id)
await client.pumping.delete(id)
console.log(`Pumping session #${id} deleted`)

license

Apache 2.0