Skip to content

Notebird-App/breeze-chms

Repository files navigation

breeze-chms

The breeze-chms javascript library provides convenient access to the Breeze REST API from applications written in server-side JavaScript (Node).

Disclaimer: API wrappers are not necessarily created or maintained by Breeze.

Installation

Install the package with:

npm install breeze-chms --save
# or
yarn add breeze-chms

Usage

This package supports both ESM and CommonJS imports.

ESM (recommended)

// Static import
import Breeze from 'breeze-chms';

// Dynamic import
const { default: Breeze } = await import('breeze-chms');

CommonJS

// require syntax
const Breeze = require('breeze-chms');

This package uses TypeScript and comes fully typed, providing code-hinting via Intellisense. If you're not familiar with TypeScript—get started today!

TypeScript Configuration

When using TypeScript, ensure your tsconfig.json has appropriate module resolution:

{
  "compilerOptions": {
    "moduleResolution": "node16", // or "bundler" for newer versions
    "module": "node16" // or "CommonJS" if using require
  }
}

The package needs to be configured with your account's subdomain and secret API key. The subdomain is what comes before breezechms.com in your browser address bar. Your unique/secret API key is available on the Extensions page of your Breeze account https://YOURSUBDOMAIN.breezechms.com/extensions/api. Require the package and initialize it with values for your subdomain and API key.

NOTE: DO NOT hardcode, expose, or otherwise commit your API key to a repository.

This package is pure ESM. It must be imported rather than required and async/await:

import Breeze from 'breeze-chms';
const breeze = new Breeze('SUBDOMAIN', 'APIKEY');

(async () => {
  const person = await breeze.people.get('PERSONID');
  console.log(person.id);
})();

Endpoints

Not all Breeze endpoints have been accounted for. See below for which ones are currently available. If you need something specific or have any comments, please open an issue—new endpoints will be implemented based on demand.

Dependencies

  • Axios - Promise based HTTP client for the browser and node.js

Contributing

Feel free to open a pull-request with any changes if you'd like to help out! To develop locally, go through these few steps to get up and running:

> git clone https://github.com/Notebird-App/breeze-chms
> cd breeze-chms
> npm install

Next, you'll need to add a .env file to the root directory that looks something like this (replacing the values with your own, of course):

subdomain=YOURSUBDOMAIN
key=YOURAPIKEY

This let's you properly run the tests via Jest. However, they might fail at first because they rely on a couple custom profile fields to be present in your account. So you can add Anniversary, Date joined, Service, and Room Number in your Breeze account as custom text fields. (You can remove these later if you wish)

Versioning

This project uses SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details