@doxbrix/sdk
v0.1.1
Published
Typed HTTP client for the Doxbrix `/v1` API. Powers the [`dxb` CLI](../../apps/cli) and any headless integration.
Readme
@doxbrix/sdk
Typed HTTP client for the Doxbrix /v1 API. Powers the dxb CLI
and any headless integration.
import { DoxbrixClient } from '@doxbrix/sdk'
const dx = new DoxbrixClient({ apiUrl: 'https://app.doxbrix.com', token: process.env.DOXBRIX_TOKEN })
const me = await dx.me()
const projects = await dx.projects.list()
const hits = await dx.search('my-docs', 'reset password')
await dx.projects.pushBundle('my-docs', { manifest, pages, publish: true })Features
- Bearer (
dxb_…PAT) auth,User-Agent, per-request timeout/abort. - HTTPS is mandatory for remote APIs (plain HTTP is limited to loopback development), and authenticated requests refuse redirects.
- Automatic retry with backoff for idempotent GETs (honors
Retry-After). - Typed resources:
me,auth,projects,pages,search,imports,git,keys,ai. - Typed errors:
DoxbrixApiError(.status,.code,.isAuth,.isEntitlement, …) andDoxbrixNetworkError.
Errors
import { DoxbrixApiError } from '@doxbrix/sdk'
try {
await dx.projects.get('nope')
} catch (e) {
if (e instanceof DoxbrixApiError && e.isNotFound) { /* … */ }
}Node ≥ 22 (uses the global fetch). Inject options.fetch to test.
