// 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 { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; /** * Logging and monitoring */ export class Tools extends APIResource { /** * Get detailed execution log by ID * * @example * ```ts * const tool = await client.logs.tools.retrieve('id'); * ``` */ retrieve(id: string, options?: RequestOptions): APIPromise { return this._client.get(path`/api/v3.1/internal/action_execution/log/${id}`, options); } /** * Search and retrieve action execution logs * * @example * ```ts * const tools = await client.logs.tools.list({ cursor: 0 }); * ``` */ list(body: ToolListParams, options?: RequestOptions): APIPromise { return this._client.post('/api/v3.1/internal/action_execution/logs', { body, ...options }); } } export interface ToolRetrieveResponse { actionId: string; actionLogId: string; app: ToolRetrieveResponse.App; connection: ToolRetrieveResponse.Connection; endTime: number; error: { [key: string]: unknown }; executionMetadata: { [key: string]: unknown }; payloadReceived: { [key: string]: unknown }; response: { [key: string]: unknown }; session: { [key: string]: unknown }; startTime: number; status: 'success' | 'error' | 'warning' | 'info'; steps: Array; totalDuration: string; version: string; } export namespace ToolRetrieveResponse { export interface App { icon: string; name: string; uniqueId: string; } export interface Connection { id: string; entity: string; } export interface Step { endTime: number; message: string; startTime: number; status: 'success' | 'failure' | 'error'; totalDuration: number; type: 'tool_execution' | 'fetch_connection_details'; logs?: Array; metadata?: Step.Metadata; } export namespace Step { export interface Log { level: string; message: string; request: Log.Request; requestId: string; response: Log.Response; time: number; type: 'network' | 'system'; } export namespace Log { export interface Request { method: string; url: string; headers?: { [key: string]: string }; json?: { [key: string]: unknown }; params?: { [key: string]: unknown }; timeout?: number; } export interface Response { status: number; time: string; } } export interface Metadata { encryption?: string; } } } export interface ToolListResponse { data: Array; nextCursor: number | null; } export namespace ToolListResponse { export interface Data { id: string; actionKey: string; app: Data.App; appKey: string; connectedAccountId: string; createdAt: number; entityId: string; executionTime: number; /** * @deprecated */ minimalResponse: string; status: 'success' | 'failed'; metadata?: Data.Metadata; } export namespace Data { export interface App { icon: string; name: string; } export interface Metadata { recipe_id?: string; } } } export interface ToolListParams { /** * cursor_that_can_be_used_to_paginate_through_the_logs */ cursor: number | null; /** * whether_the_search_is_case_sensitive_or_not */ case_sensitive?: boolean | null; /** * start_time_of_the_logs_in_epoch_time */ from?: number; /** * number_of_logs_to_return */ limit?: number; search_params?: Array; /** * end_time_of_the_logs_in_epoch_time */ to?: number; } export namespace ToolListParams { export interface SearchParam { field?: string; operation?: string; value?: string; } } export declare namespace Tools { export { type ToolRetrieveResponse as ToolRetrieveResponse, type ToolListResponse as ToolListResponse, type ToolListParams as ToolListParams, }; }