gymhappy-client

JS client for interfacing with the Gym Happy API

Usage no npm install needed!

<script type="module">
  import gymhappyClient from 'https://cdn.skypack.dev/gymhappy-client';
</script>

README

Gym Happy API client

Interface with your Gym Happy account, without the hassle.

This package is intended to perform basic API functions within Gym Happy, without having to worry about manually providing request cache data/encoding request integrity. This module exposes simple JS/TS functions which can be used to imperatively make requests directly to Gym Happy.


Usage

import gymHappy from 'gymhappy-client';

const gym = gymHappy('==API KEY==', '==CLIENT UID==');

// Register event for customer
gym.register(
    '==CUSTOMER ID==',

    // Register that `checkins`=24 for this customer
    'checkins',
    24,

    // Set the metadata that apply to this given checkin
    [
        ['coach', 'John'],
        ['time', 6],
    ]
);

// Set a customer's user data
gym.setCustomer(
    '==CUSTOMER ID==',

    // User data - createdAt and updatedAt are automatically set
    // and are ignored if passed here.
    {
        firstName: 'John',
        surname: 'Smith',
        customerMetadata: 4.2,

        // ignored property - is immutable/reserved
        belongsTo: '==CLIENT ID==',
    }
)