@x12i/xentra-sdk
v0.2.0
Published
Node.js SDK for Xentra
Readme
@x12i/xentra-sdk
Node.js and TypeScript HTTP client for the Xentra API.
Install
npm install @x12i/xentra-sdkUsage
import { createXentraClient, XentraApiError } from "@x12i/xentra-sdk";
const client = createXentraClient({
baseUrl: "http://localhost:8787",
apiKey: process.env.XENTRA_API_KEY,
});
const { data: account } = await client.accounts.create({
name: "Acme",
slug: "acme",
});
const agents = await client.agents.list(account.id);
const allowed = await client.permissions.can(account.id, {
actor: { type: "user", id: "user_1" },
action: "agents.manage",
resource: { resourceType: "agent" },
context: { accountId: account.id },
});
const { data: issued } = await client.tokens.issue(account.id, {
appId: "my-app",
actor: { type: "serviceAccount", id: "svc_1" },
scope: {},
});API surface
| Namespace | Methods |
|-----------|---------|
| accounts | create, list, get |
| users | me, get |
| agents | create, list |
| permissions | can |
| tokens | issue, verify, revoke, list |
Errors throw XentraApiError with status and parsed body.
Related packages
@x12i/xentra-openapi— API contract this client targets@x12i/xentra-api— server implementation@x12i/xentra-admin— uses this SDK
Development
npm run build -w @x12i/xentra-sdk
npm test -w @x12i/xentra-sdkLicense
MIT
