@riposte.co/sdk
v0.4.0
Published
Official Riposte Node SDK
Downloads
49
Readme
Riposte Node SDK
This package provides a typed client for interacting with the Riposte HTTP API. The SDK is generated from the openapi-formatted.json specification and exposes fully typed request and response helpers.
Development
Generate the latest TypeScript types and runtime metadata:
npm run generate:sdkBuild the compiled JavaScript and type declaration files into sdk/dist:
npm run build:sdkUsage
import { createRiposteSdk, RiposteRequestError } from '@riposte.co/sdk';
const apiKey = process.env.RIPOSTE_API_KEY;
if (!apiKey) {
throw new Error('Set the RIPOSTE_API_KEY environment variable before creating the SDK.');
}
const sdk = createRiposteSdk({
apiKey,
baseUrl: process.env.RIPOSTE_API_URL,
});
const accounts = await sdk.accounts.listAccounts({
page: 1,
limit: 20,
});
for (const account of accounts.accounts ?? []) {
console.log(account.email);
}
// Each generated method accepts a plain object with any required path parameters and
// optional query/header values flattened at the top level. Numeric filters such as
// page and limit are exposed as numbers for convenience.
const { authUrl } = await sdk.authentication.createSingleUseOauthSession({
redirectUri: 'https://example.com/oauth/callback',
});
try {
await sdk.accounts.deleteAnAccountAndAllRelatedData({
id: 'account_123',
});
} catch (error) {
if (error instanceof RiposteRequestError) {
console.error(error.message, error.status);
}
}
// Low-level access remains available when you need the request builder:
const response = await sdk.client.get('/accounts/{accountId}', {
pathParams: { accountId: 'account_123' },
});The generated SDK groups every API operation by its tag and exposes descriptive, strongly typed
methods. If you need the underlying request builder, the instantiated sdk also exposes the
configured RiposteClient as sdk.client.
