| name | maintainx-sdk-patterns |
| description | Learn MaintainX REST API patterns, pagination, filtering, and client architecture.
Use when building robust API integrations, implementing pagination,
or creating reusable SDK patterns for MaintainX.
Trigger with phrases like "maintainx sdk", "maintainx api patterns",
"maintainx pagination", "maintainx filtering", "maintainx client design".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Grep |
| version | 1.11.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","maintainx","api"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
MaintainX SDK Patterns
Overview
Production-grade patterns for building robust MaintainX API integrations with proper error handling, cursor-based pagination, retry logic, and type safety.
Prerequisites
- Completed
maintainx-install-auth setup
- TypeScript/Node.js familiarity
- Understanding of REST API principles
Instructions
Step 1: Type-Safe Client with Generics
import axios, { AxiosInstance, AxiosRequestConfig, AxiosError } from 'axios';
interface PaginatedResponse<T> {
cursor: string | null;
}
interface WorkOrder {
id: number;
title: string;
status: 'OPEN' | 'IN_PROGRESS' | 'ON_HOLD' | 'COMPLETED' | 'CLOSED';
priority: 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH';
description?: string;
assignees: Array<{ type: 'USER' | 'TEAM'; id: number }>;
assetId?: number;
locationId?: number;
createdAt: string;
: ;
?: ;
?: ;
: [];
}
{
: ;
: ;
?: ;
?: ;
?: ;
?: ;
: ;
}
<> {
: [];
}
<> {
: [];
}
{
: ;
() {
key = apiKey || process..;
(!key) ();
. = axios.({
: ,
: { : , : },
: ,
});
}
(?: <, >): <> {
{ data } = ..<>(, { params });
data;
}
(: ): <> {
{ data } = ..<>();
data;
}
(: <>): <> {
{ data } = ..<>(, input);
data;
}
(: , : <>): <> {
{ data } = ..<>(, input);
data;
}
(?: <, >): <> {
{ data } = ..<>(, { params });
data;
}
request<T = >(: , : , ?: ): <T> {
: = { method, : path, : body };
{ data } = ..<T>(config);
data;
}
}