@riposte.co/sdk
Overview
Section titled “Overview”The Riposte SDK wraps every OpenAPI endpoint with strongly typed methods so you
can call the platform without hand-writing fetch logic. Each operation lives in
an intuitive namespace (for example sdk.accounts.list) and the
responses mirror the server’s OpenAPI schema.【F:product/sdk/README.md†L1-L69】
Quick start
Section titled “Quick start”import { createRiposteSdk, RiposteRequestError } from '@riposte.co/sdk';
const sdk = createRiposteSdk({ apiKey: process.env.RIPOSTE_API_KEY!, baseUrl: process.env.RIPOSTE_API_URL,});
const accounts = await sdk.accounts.list({ page: 1, limit: 20 });【F:product/sdk/README.md†L19-L58】
The instantiated client exposes every generated operation plus the underlying
RiposteClient as sdk.client for advanced scenarios such as custom request
signatures.【F:product/sdk/README.md†L61-L65】
Creating a client
Section titled “Creating a client”createRiposteSdk accepts either an API key string or a configuration object
with apiKey, optional baseUrl, and custom fetch or header overrides.【F:product/sdk/src/sdk.ts†L71-L126】
- The helper falls back to
RIPOSTE_API_URL/NEXT_PUBLIC_RIPOSTE_API_URL/VITE_RIPOSTE_API_URLwhenbaseUrlis omitted, trimming trailing slashes in the process.【F:product/sdk/src/sdk.ts†L8-L53】 - Authorization headers are injected automatically unless you pass
includeApiKey: false; in that case provide your ownAuthorizationandx-api-keyheaders.【F:product/sdk/src/sdk.ts†L55-L103】 - Passing an existing
RiposteClientinstance reuses its fetch implementation and configuration.【F:product/sdk/src/sdk.ts†L106-L126】
For lower-level access you can import createRiposteClient directly and work
with raw request builders; both factories are exported from the package entry
point.【F:product/sdk/src/index.ts†L1-L12】
Error handling
Section titled “Error handling”The SDK throws RiposteRequestError whenever the server responds with a non-2xx
status. The error object includes the HTTP status, parsed error payload, failed
method, and request path so you can surface precise failures in your
application.【F:product/sdk/src/sdk.ts†L128-L157】
try { await sdk.accounts.delete({ accountId: 'acct_123' });} catch (error) { if (error instanceof RiposteRequestError) { console.error(error.status, error.message); }}【F:product/sdk/README.md†L51-L59】
Generated operations
Section titled “Generated operations”Every resource tag in the OpenAPI document becomes a namespace on the SDK. Here are some of the most common helpers and the response documentation they map to:
| Namespace | Signature | Response documentation |
|---|---|---|
sdk.accounts.list({ page?, limit?, pageToken?, cursor? }) | Lists accounts with optional pagination filters.【F:product/sdk/src/generated/operations.ts†L40-L123】 | Returns AccountListResponse – see the Accounts API.【F:product/api-types/src/generated.ts†L4-L35】 |
sdk.authentication.createSession({ provider?, redirectUri?, customUserId?, email?, expiresInMinutes?, forceConsent? }) | Creates a hosted OAuth session and returns the URL for your end user.【F:product/sdk/src/generated/operations.ts†L3155-L3226】 | Yields session metadata with code, authUrl, and expiresAt – review the Authentication API.【F:product/api-types/src/generated.ts†L958-L965】 |
sdk.messages.list({ accountId, page?, limit?, labelId?, mailbox?, maxResults?, cursor? }) | Pulls a paginated slice of messages for the selected account.【F:product/sdk/src/generated/operations.ts†L1745-L1820】 | Returns MessageListResponse from the Messages API.【F:product/api-types/src/generated.ts†L130-L201】 |
sdk.webhooks.createEndpoint({ id?, url, secret?, isActive?, retryCount?, timeoutMs?, retryDelayMs?, eventTypes?, headers? }) | Registers a webhook endpoint and optional delivery tuning parameters.【F:product/sdk/src/generated/operations.ts†L6415-L6459】 | Receives the persisted endpoint configuration described in the Webhooks API.【F:product/api-types/src/generated.ts†L1961-L1999】 |
Because the SDK re-exports the generated type definitions, you can import any schema or response type alongside the runtime helpers for full end-to-end TypeScript coverage.【F:product/sdk/src/index.ts†L1-L12】