/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { tasksDownloadTaskExport } from "../funcs/tasks-download-task-export.js"; import { tasksGetTaskResult } from "../funcs/tasks-get-task-result.js"; import { tasksGetTask } from "../funcs/tasks-get-task.js"; import { tasksListTasks } from "../funcs/tasks-list-tasks.js"; import { tasksUpdateTaskStatus } from "../funcs/tasks-update-task-status.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { unwrapAsync } from "../types/fp.js"; import * as models from "./models/index.js"; export class Tasks extends ClientSDK { /** * List tasks * * @remarks * Use when listing or searching async tasks (e.g. admin queue view). Returns list with optional filtering. */ async listTasks( request?: models.ListTasksRequest | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(tasksListTasks( this, request, options, )); } /** * Get task processing result * * @remarks * Use when fetching the outcome of a completed task (e.g. export URL or error message). Call after task status is complete. */ async getTaskResult( workflowId: string, options?: RequestOptions, ): Promise { return unwrapAsync(tasksGetTaskResult( this, workflowId, options, )); } /** * Get a task * * @remarks * Use when checking task status or progress (e.g. polling after create). Returns task by ID. */ async getTask( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(tasksGetTask( this, id, options, )); } /** * Download task export file * * @remarks * Use when letting a user download an exported file (e.g. report or data export). Returns a presigned URL; supports FlexPrice or customer-owned S3. */ async downloadTaskExport( id: string, options?: RequestOptions, ): Promise<{ [k: string]: string }> { return unwrapAsync(tasksDownloadTaskExport( this, id, options, )); } /** * Update task status * * @remarks * Use when updating task status (e.g. marking complete or failed from a worker). Typically called by backend processors. */ async updateTaskStatus( id: string, body: models.UpdateTaskStatusRequest, options?: RequestOptions, ): Promise { return unwrapAsync(tasksUpdateTaskStatus( this, id, body, options, )); } }