Skip to main content

User Tasks API Client

Important

This API client is entirely optional. While it provides type-safe functions and convenience methods, you can interact directly with the User Tasks API using standard HTTP requests. The client simply makes it easier to integrate with the API by providing a typed interface and handling common patterns.

The User Tasks API Client is a TypeScript library that provides a type-safe interface for interacting with the User Tasks API.

Installation

npm install @littlehorse-enterprises/user-tasks-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 API. For detailed configuration instructions, see the Configuration Guide.

Basic Usage

import { LittleHorseUserTasksApiClient } from "@littlehorse-enterprises/user-tasks-api-client";

const client = new LittleHorseUserTasksApiClient({
baseUrl: "Wherever your User Tasks API 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:

  1. User Methods - For regular task interactions
  2. 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.