API Client
The open-source User Tasks Bridge API Client is a javascript library that provides a type-safe interface for interacting with the User Tasks Bridge Backend.
This API client is entirely optional. While it provides type-safe functions and convenience methods, you can interact directly with the User Tasks Bridge Backend using standard HTTP requests. The client simply makes it easier to integrate with the API by providing a typed interface and handling common patterns.
Installation
- npm
- yarn
- pnpm
- bun
npm install @littlehorse-enterprises/user-tasks-bridge-api-client
yarn add @littlehorse-enterprises/user-tasks-bridge-api-client
pnpm add @littlehorse-enterprises/user-tasks-bridge-api-client
bun add @littlehorse-enterprises/user-tasks-bridge-api-client
Authentication
You'll need to provide an access token when initializing the client. You can obtain this token through your organization's OIDC provider configured in the User Tasks Bridge Backend. For detailed configuration instructions, see the Configuration Guide.
Basic Usage
import { LHSWBApiClient } from "@littlehorse-enterprises/user-tasks-bridge-api-client";
const client = new LHSWBApiClient({
baseUrl:
"Wherever your User Tasks Bridge Backend is hosted (e.g. http://localhost:8089)",
tenantId: "Your organization's tenant ID (e.g. default)",
accessToken:
"Your organization's OAuth access token (e.g. your-oauth-access-token)",
});
// List user tasks with pagination
const response = await client.listUserTasks({
limit: 10,
type: "approval",
status: "UNASSIGNED",
});
API Reference
The client provides two categories of methods:
- User Methods - For regular task interactions
- Admin Methods - For managing tasks and users
For a complete list of available methods and their parameters, see the API Methods Reference.
Error Handling
The client provides specific error types for different scenarios. See the Error Handling Guide for details on handling different types of errors.