// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; export class History extends APIResource { /** * Get task completion history for the current user, showing execution status and * details. Supports searching across multiple fields (currently: title) with * case-insensitive partial matching. */ list( params: HistoryListParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...query } = params ?? {}; return this._client.get('/scheduler/task-history', { query, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } export type HistoryListResponse = Array; export namespace HistoryListResponse { /** * Model representing a task completion history record. * * Attributes: id (str): Unique identifier for the history record. job_id (str): * APScheduler job ID. title (str): Display name for the task. chatbot_id (str | * None): Associated chatbot ID. chatbot_display_name (str | None): Display name of * the associated chatbot. conversation_id (str | None): Associated conversation * ID. status (str): Execution status (success, failed, etc.). error (str | None): * Error message if task failed. run_at (datetime): When the task was executed. * created_at (datetime): When the history record was created. */ export interface HistoryListResponseItem { /** * Unique identifier for the history record */ id: string; /** * When the history record was created */ created_at: string; /** * APScheduler job ID */ job_id: string; /** * When the task was executed */ run_at: string; /** * Execution status (success, failed, etc.) */ status: string; /** * Display name for the task */ title: string; /** * Display name of the associated chatbot */ chatbot_display_name?: string | null; /** * Associated chatbot ID */ chatbot_id?: string | null; /** * Associated conversation ID */ conversation_id?: string | null; /** * Error message if task failed */ error?: string | null; } } export interface HistoryListParams { /** * Query param: Maximum number of records to return */ limit?: number | null; /** * Query param: Search term (searches across title and other fields) */ search?: string | null; /** * Query param: Type of task (message, etc.) */ type?: string | null; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export declare namespace History { export { type HistoryListResponse as HistoryListResponse, type HistoryListParams as HistoryListParams }; }