JavaScript SDK
The JavaScript SDK is the typed client for the REST API.
It includes generated API clients, TypeScript models, bearer-token auth through Configuration.accessToken, and webhook event types. The package has no runtime dependencies.
Read the SDK docs
Getting started
Install it in a Node.js or TypeScript project:
npm i @onehorizon/sdk-js@latestPass any One Horizon bearer credential to Configuration.accessToken: a workspace API key for internal services, or an OAuth access token from an OAuth app.
import { Configuration, TasksApi, TaskScope, TaskStatus } from '@onehorizon/sdk-js' const config = new Configuration({ accessToken: process.env.ONE_API_KEY })const tasks = new TasksApi(config) const { tasks: active } = await tasks.listTasks({ workspaceId: 'current', scope: [TaskScope.Initiative], status: [TaskStatus.Planned, TaskStatus.InProgress, TaskStatus.Review]}) console.log(active.map(({ taskId, title }) => ({ taskId, title })))
Webhook receivers
The webhook templates linked from Custom App use the SDK for CloudEvents typing and optional follow-up API calls. Webhooks covers delivery, verification, retries, and event handling.