-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(api-client): concise README (#48)
- Loading branch information
1 parent
2af9af9
commit bf487c1
Showing
1 changed file
with
9 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,24 @@ | ||
# LH User Tasks API Client | ||
|
||
A TypeScript client for interacting with LittleHorse User Tasks API. | ||
A lightweight TypeScript client for interacting with LittleHorse [User Tasks API](https://littlehorse.io/docs/user-tasks/api). | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install @littlehorse-enterprises/user-tasks-api-client | ||
``` | ||
|
||
## Authentication | ||
## Documentation | ||
|
||
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** configs. | ||
For detailed documentation, including: | ||
|
||
## Usage | ||
- Complete API reference | ||
- Advanced usage examples | ||
- Error handling guides | ||
- Type definitions | ||
|
||
### Basic Example | ||
|
||
```typescript | ||
import { LittleHorseUserTasksApiClient } from "@littlehorse-enterprises/user-tasks-api-client"; | ||
|
||
const client = new LittleHorseUserTasksApiClient({ | ||
baseUrl: "http://localhost:8089", | ||
tenantId: "default", | ||
accessToken: "your-oauth-access-token", | ||
}); | ||
|
||
// List user tasks with pagination | ||
const response = await client.listUserTasks({ | ||
limit: 10, | ||
offset: 0, | ||
}); | ||
|
||
console.log(response); | ||
``` | ||
|
||
```typescript | ||
// example console output | ||
{ | ||
userTasks: [ | ||
{ | ||
id: "123e4567-e89b-12d3-a456-426614174000", | ||
wfRunId: "987fcdeb-4321-12d3-a456-426614174000", | ||
userTaskDefName: "approve_request", | ||
status: "UNASSIGNED", | ||
notes: "Please review this purchase request", | ||
scheduledTime: "2024-03-20T15:30:00Z", | ||
userGroup: { | ||
id: "550e8400-e29b-41d4-a716-446655440000", | ||
name: "Finance Team", | ||
valid: true | ||
} | ||
}, | ||
{ | ||
id: "550e8400-e29b-41d4-a716-446655440001", | ||
wfRunId: "123e4567-e89b-12d3-a456-426614174001", | ||
userTaskDefName: "review_document", | ||
status: "ASSIGNED", | ||
notes: "Document needs final approval", | ||
scheduledTime: "2024-03-20T14:00:00Z", | ||
userGroup: { | ||
id: "legal", | ||
name: null, | ||
valid: false // This means the user group does not exist in the OIDC provider the api is configured with | ||
}, | ||
user: { | ||
id: "123e4567-e89b-12d3-a456-426614174002", | ||
email: "[email protected]", | ||
firstName: "John", | ||
lastName: "Doe", | ||
valid: true | ||
} | ||
} | ||
], | ||
bookmark: "eyJwYWdlIjoyLCJsaW1pdCI6MTB9" | ||
} | ||
``` | ||
|
||
### Response Format | ||
|
||
```typescript | ||
type ListUserTasksResponse = { | ||
userTasks: Array<{ | ||
id: string; | ||
wfRunId: string; | ||
userTaskDefName: string; | ||
status: Status; | ||
notes: string; | ||
scheduledTime: string; | ||
userGroup?: UserGroup; | ||
user?: User; | ||
}>; | ||
bookmark: string | null; | ||
}; | ||
``` | ||
|
||
## API Methods | ||
|
||
The client provides the following methods: | ||
|
||
- `listUserTasks(params)`: Retrieve a paginated list of user tasks | ||
- `getUserTask(id)`: Get details of a specific user task | ||
- `completeUserTask(id, result)`: Complete a user task with a result | ||
- Additional methods... | ||
|
||
For detailed API documentation, please visit [our documentation](https://littlehorse.dev/docs/overview). | ||
|
||
## Development | ||
|
||
To contribute to this project, please follow our [contribution guidelines](https://github.com/littlehorse-enterprises/lh-user-tasks-api-client/blob/main/CONTRIBUTING.md). | ||
Visit our [official documentation](https://littlehorse.io/docs/user-tasks/api-client). | ||
|
||
## License | ||
|
||
This project is licensed under the [Apache 2.0 License](LICENSE.md). | ||
Apache 2.0 - See [LICENSE](LICENSE.md) for details. |