npm install @mobilizehub/api
- 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.
All methods return either an error
or a result
field, never both and never none. This approach helps with proper error handling.
{
result: T; // The result depends on what method you called
}
{
error: {
message: string;
docs: string; // URL to relevant documentation
}
}
### Retries
Configure retry behavior for network errors:
```ts
const mobilizehub = new MobilizeHub({
apiKey: "<MOBILIZEHUB_API_KEY>",
retry: {
attempts: 3,
backoff: (retryCount) => retryCount * 1000,
},
});