JavaScript client
@devium/rms is the official TypeScript client. It ships one client per API domain — each wraps a backend service, with typed methods, request/response models, and automatic case conversion.
Install
npm install @devium/rms
The clients
Every client is exported from the package root and defaults to its own versioned base path.
| Client | Default base path | Covers |
|---|---|---|
AuthApiClient | /api/v1/auth | Login, token refresh, validation |
UserApiClient | /api/v1/users | Users and user data |
OrganizationApiClient | /api/v1/organizations | Organizations, locations, members |
ResourceApiClient | /api/v1/resources | Pools, resources, bookings, queues |
AnalyticsApiClient | /api/v1/analytics | State and utilization analytics |
LCMApiClient | /api/v1/lcm | Lifecycle state transitions |
KeepAliveApiClient | /api/v1/keep-alive | Resource heartbeats |
HostAgentApiClient | /api/v1/host-agent-service | Host agent operations |
CentralAgentApiClient | /api/v1/central-agent | Central agent coordination |
BaseApiClient (the shared base) and ApiError are exported too, along with every request/response type.
Set up a client
Each client takes a base URL. In a browser app served from the same origin, the default relative path works as-is; from Node or another origin, pass the full URL. Authenticate by setting the access token (see Authentication).
import { AuthApiClient, ResourceApiClient } from '@devium/rms';
const host = 'https://app.devium.io';
const auth = new AuthApiClient(`${host}/api/v1/auth`);
const { accessToken } = await auth.login({ username: 'you@example.com', password: '••••••••' });
const resources = new ResourceApiClient(`${host}/api/v1/resources`);
resources.setAccessToken(accessToken);
setAccessToken(token) and clearAccessToken() are available on every client (inherited from BaseApiClient).
Conventions
A few behaviours are shared across all clients:
camelCase everywhere. You pass and receive
camelCase; the client converts to the API'ssnake_caseon the way out and back on the way in. WriteavailableFrom, notavailable_from.Pagination. List endpoints accept
page,limit,sortBy, andsortOrder, and return aPaginatedResponse<T>:interface PaginatedResponse<T> { items: T[]; totalCount: number; page: number; limit: number; totalPages: number; }Field selection. Pass a
fieldsstring (comma-separated, camelCase) to trim the response to the fields you need.
const page = await resources.getAllResources(poolId, {
bookable: true,
fields: 'id,name,state',
page: 1,
limit: 20,
sortBy: 'name',
sortOrder: 'asc',
});
console.log(page.items, `of ${page.totalCount}`);
Next steps
- Clients reference — the methods on each client.
- Error handling — working with
ApiError.