Skip to content

HawAPI/js-sdk

Repository files navigation

HawAPI - js-sdk

HawAPI SDK for JavaScript/TypeScript

Topics

Installation

Npm

npm install @hawapi/js-sdk

Yarn

yarn add @hawapi/js-sdk

Cdn

<script src="https://cdn.jsdelivr.net/npm/@hawapi/js-sdk/dist/index.umd.min.js"></script>

Usage

Init client

Javascript (UMD)

const client = HawAPI.createClient();
// Also valid:
// const { createClient } = HawAPI
// const client = createClient()
console.log('HawAPI client: ', client);

Javascript (ESM)

import { createClient } from '<path>';
const client = createClient();
console.log('HawAPI client: ', client);

Error handling

Then/Catch

const result = client
  .getAll('actors')
  .then((data) => data)
  .catch((err) => console.error(err));

Try/Catch

let result;
try {
  result = await client.getAll('actors');
} catch (err) {
  console.error(err);
}

Repository template

This repository uses typescript-library-boilerplate as template.