1.0.0 • Published 6 years ago
hatchbaby v1.0.0
hatchbaby
Unofficial JavaScript REST API client for the Hatch Baby app
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
1.0.0
6 years ago