@binalyze/air-sdk
v5.6.7
Published
Binalyze AIR - Typescript Axios SDK
Downloads
344
Keywords
Readme
@binalyze/air-sdk
AIR SDK (typescript-axios) bundled with an API surface.
Requirements
- Node >= 18
- axios >= 1 (peer dependency)
Install
yarn add @binalyze/air-sdk axiosQuick start
import { AIR } from '@binalyze/air-sdk';
const air = new AIR(process.env.AIR_BASE_URL, process.env.AIR_TOKEN);
const baseUrl = process.env.AIR_DEV_URL;
const token = process.env.AIR_API_TOKEN;
if (!baseUrl || !token) {
throw new Error('AIR_DEV_URL and AIR_API_TOKEN must be set in .env file');
}
const air = new AIR(baseUrl, token);
// List users (paginated array with optional _pagination metadata)
const users = await air.users.getMany({ pageNumber: 1, pageSize: 10 });
console.log('Users count:', users.length);Usage notes
- The package exposes only
AIRas the public entry. - Under the hood it configures:
- Authorization header
- deepObject query serialization
- success/error response normalization
- List endpoints return arrays that also carry pagination metadata via an optional
_paginationproperty. - When organization scoping is omitted, defaults may apply (e.g.,
organizationIdsdefault to[0]).
Examples
// Acquire baseline evidence for specific endpoints and an optional case
const baseline = await air.baseline.acquire({
caseId: 'C-2025-0007',
filter: {
includedEndpointIds: ['f9032a34-8e6d-4875-b1c3-a60d23506746'],
// organizationIds will default to [0] if omitted
},
});
console.log('Baseline:', baseline);
// Get case activities (paginated array)
const getActivities = await air.cases.getActivities({ id: 'C-2025-0007' });
console.log(
'First activity case ID for C-2025-0007:',
getActivities[0].data.caseId,
);
// List API tokens (paginated array)
const getApiTokens = await air.apiTokens.getMany();
console.log('API Tokens:', getApiTokens);
// List users with simple pagination and sorting
const usersPage = await air.users.getMany({
pageNumber: 1,
pageSize: 20,
sortBy: 'createdAt',
sortType: 'DESC',
});
console.log('Users (latest first):', usersPage);Support
Please open an internal ticket or contact the maintainers.
