sdk

Hoody SDK

TypeScript & JavaScript SDK for the Hoody platform

Install

npm i hoody-sdk

Use it

import { HoodyClient } from 'hoody-sdk';

const hoody = await HoodyClient.login('https://api.hoody.com', {
  username,
  password,
});

const { data: me } = await hoody.api.auth.whoami();

In the browser

<script
  src="https://cdn.jsdelivr.net/npm/hoody-sdk/dist/hoody-sdk.browser.min.js">
</script>
<script>
  const { HoodyClient } = window.HoodySDK;
  const hoody = new HoodyClient({ baseURL: 'https://api.hoody.com', token });
</script>

Or as an ES module:

import { HoodyClient }
  from "https://cdn.jsdelivr.net/npm/hoody-sdk/dist/hoody-sdk.browser.esm.js";

Pin a version in production. The URLs above always load the newest release, so your page can change without you changing it. Add @<version> once you ship; the current version is on the npm page.

A token in a web page works like a password. Never put an account-wide token in a static page: create a short-lived token with only the access the page needs, from your own backend.

The CLI is included

The same package ships the hoody command, so npx hoody-sdk runs the CLI without installing anything.