API Reference
Complete method signatures and TypeScript types for the Devloom SDK.
dlx.client()
Creates an authenticated client instance for a connector.
| Parameter | Type | Required | Description |
|---|---|---|---|
connector | string | Yes | Connector slug (e.g. 'fieldvault-crm') |
auth | AuthConfig | Yes | Auth strategy from dlx.auth.* |
retry | RetryConfig | No | Override default retry behavior |
timeout | number | No | Request timeout in ms (default: 30000) |
client.query()
Returns a chainable query builder for a resource type.
| Method | Returns | Description |
|---|---|---|
.filter(predicates) | QueryBuilder | Apply server-side filters |
.select(fields[]) | QueryBuilder | Limit returned fields |
.autopage() | QueryBuilder | Enable automatic pagination |
.limit(n) | QueryBuilder | Max records to return |
.all() | Promise<T[]> | Execute and return all records |
.first() | Promise<T> | Return first matching record |
.count() | Promise<number> | Return count without fetching records |
dlx.auth
Auth strategy constructors. Pass the result to dlx.client({ auth }).
// OAuth2 with auto token refresh
dlx.auth.oauth2({
clientId: '...',
clientSecret: '...',
scopes: ['read', 'write'],
autoRefresh: true
});
// API key header
dlx.auth.apiKey({ header: 'X-API-Key', value: process.env.API_KEY });
// Bearer token
dlx.auth.bearer({ token: process.env.BEARER_TOKEN });
client.stream()
Subscribe to real-time webhook events with a normalized event schema.
const sub = client
.stream('opportunity.created')
.on('event', (e: DlxEvent) => {
// e.type, e.record, e.timestamp
})
.on('error', console.error);
// Close subscription
sub.close();
TypeScript Types
interface DlxClient {
query<T>(resource: string): QueryBuilder<T>;
stream(event: string): StreamSubscription;
mutate<T>(resource: string, data: Partial<T>): Promise<T>;
}
interface DlxEvent<T = Record<string, unknown>> {
type: string;
record: T;
timestamp: string;
connector: string;
}