@mobilizehub/api
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

@mobilizehub/api

`@mobilizehub/api` is a TypeScript client for MobilizeHub. If you prefer a typed experience over calling HTTP endpoints directly, this SDK is for you.

Installation

npm install @mobilizehub/api

Quickstart

  1. Create a new MobilizeHub API Key.
  2. Use the API key to initialize the client:
import { MobilizeHub } from "@mobilizehub/api";

const mobilizehub = new MobilizeHub({ apiKey: "<MOBILIZEHUB_API_KEY>" });

Important: Always keep your root key safe and reset it if you suspect it has been compromised.

Response Format

All methods return either an error or a result field, never both and never none. This approach helps with proper error handling.

Success Response

{
  result: T; // The result depends on what method you called
}

Error Response

{
  error: {
    message: string;
    docs: string; // URL to relevant documentation
  }
}

Configuration Options


### Retries

Configure retry behavior for network errors:

```ts
const mobilizehub = new MobilizeHub({
  apiKey: "<MOBILIZEHUB_API_KEY>",
  retry: {
    attempts: 3,
    backoff: (retryCount) => retryCount * 1000,
  },
});

Documentation

Read the full documentation

/@mobilizehub/api/

    Package Sidebar

    Install

    npm i @mobilizehub/api

    Weekly Downloads

    28

    Version

    0.4.2

    License

    MIT

    Unpacked Size

    319 kB

    Total Files

    13

    Last publish

    Collaborators

    • ryanmearns