@hypi/hypi-client-nodejs
TypeScript icon, indicating that this package has built-in type declarations

1.0.21 • Public • Published

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@organization.org', '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@organization.com", "secret-password", null, null, {}
  )

hypiClient.createAccount(
  "email@organization.com", "secret-password", "firstName", "lastName", {}
  )

hypiClient.createAccount(
  "email@organization.com", "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)

Package Sidebar

Install

npm i @hypi/hypi-client-nodejs

Weekly Downloads

22

Version

1.0.21

License

ISC

Unpacked Size

34.5 kB

Total Files

17

Last publish

Collaborators

  • eman2008
  • qamaruddin
  • damionx
  • zcourts