@hypi/hypi-client-nodejs
v1.0.21
Published
graphql interface client for hypi functionality
Downloads
7
Readme
Hypi NodeJS Client
A NodeJS library to interface with Hypi low-code platform
Setup
npm -i @hypi/hypi-client-nodejs
Usage
Instantiate
const HypiClient = require("@hypi/hypi-client-nodejs")
const hypiClient = new HypiClient.HypiClient('foo.apps.hypi.app')
// changing app
hypiClient.setDomain('bar.apps.hypi.app')
Authentication
hypiClient.login('[email protected]', 'secret-password')
The function createAccount
accepts parameters of email
, password
, firstName
, lastName
, otherJsonObj
The firstName
and lastName
should be null
if not provided
The otherJsonObj
should be empty object if not provided or any more additional fields that the Hypi core type Account
accepts.
The following examples demonstrate such:
hypiClient.createAccount(
"[email protected]", "secret-password", null, null, {}
)
hypiClient.createAccount(
"[email protected]", "secret-password", "firstName", "lastName", {}
)
hypiClient.createAccount(
"[email protected]", "secret-password", "firstName", "lastName", {
"owner": {
"dob": "2008-09-15T15:53:00"
}
}
)
CRUD APIs
hypiClient.upsert({
Pair: {
hypi: {
id: 'pairId'
},
key: 'k',
value: 'v'
}
})
hypiClient.get('Pair', 'pairId', `{
... on Pair {
hypi {
id
}
key
value
}
}`)
hypiClient.find('Pair', 'hypi.id=\'pairId\'', `{
... on Pair {
hypi {
id
}
key
value
}
}`)
hypiClient.trash('Pair', 'hypi.id = \'pairId\'')
hypiClient.untrash('Pair', 'hypi.id = \'pairId\'')
hypiClient.delete('Pair', 'hypi.id = \'pairId\'')
Mutation/Query
hypiClient.getGqlClient().query(query, variables)
hypiClient.getGqlClient().mutate(mutation, variables)