@mobilizehub/api
v0.4.2
Published
<div align="center"> <h1 align="center">@mobilizehub/api</h1> <h5>`@mobilizehub/api` is a TypeScript client for MobilizeHub. If you prefer a typed experience over calling HTTP endpoints directly, this SDK is for you.</h5> </div>
Readme
Installation
npm install @mobilizehub/apiQuickstart
- Create a new MobilizeHub API Key.
- 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,
},
});