// 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 Triggers extends APIResource { /** * DEPRECATED: This endpoint has declining traffic and will be removed in a future * version. * * @deprecated */ retrieve(id: string, options?: RequestOptions): APIPromise { return this._client.get(path`/api/v3.1/internal/trigger/log/${id}`, options); } /** * Search and retrieve trigger event logs with advanced filtering capabilities * including search parameters * * @example * ```ts * const triggers = await client.logs.triggers.list(); * ``` */ list( body: TriggerListParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.post('/api/v3.1/internal/trigger/logs', { body, ...options }); } } export interface TriggerRetrieveResponse { log: TriggerRetrieveResponse.Log; } export namespace TriggerRetrieveResponse { export interface Log { id: string; appName: string; clientId: string; connectionId: string; createdAt: string; entityId: string; meta: Log.Meta; status: string; /** * Log entity type (trigger or action) */ type: 'trigger' | 'action'; } export namespace Log { export interface Meta { id: string; clientId: string; connectionId: string; createdAt: string; provider: string; /** * Log entity type (trigger or action) */ type: 'trigger' | 'action'; updatedAt: string; triggerClientError?: string; triggerClientPayload?: string; triggerClientResponse?: string; triggerId?: string; triggerName?: string; triggerNanoId?: string; triggerProviderPayload?: string; } } } export interface TriggerListResponse { nextCursor: string | null; data?: Array; } export namespace TriggerListResponse { export interface Data { id: string; appName: string; clientId: string; connectionId: string; createdAt: string; entityId: string; meta: Data.Meta; status: string; /** * Log entity type (trigger or action) */ type: 'trigger' | 'action'; } export namespace Data { export interface Meta { id: string; clientId: string; connectionId: string; createdAt: string; provider: string; /** * Log entity type (trigger or action) */ type: 'trigger' | 'action'; updatedAt: string; triggerClientError?: string; triggerClientPayload?: string; triggerClientResponse?: string; triggerId?: string; triggerName?: string; triggerNanoId?: string; triggerProviderPayload?: string; } } } export interface TriggerListParams { cursor?: string | null; entityId?: string; /** * Start time for logs (epoch timestamp in milliseconds) */ from?: number | null; /** * Whether to include payload fields in the response. Set to false for faster list * views. */ include_payload?: boolean; integrationId?: string; /** * The limit of trigger logs to return */ limit?: number | null; /** * Search term to filter logs */ search?: string; /** * Advanced search parameters for filtering logs */ search_params?: Array; /** * Filter logs by their status level */ status?: 'all' | 'success' | 'error'; /** * Return logs from the last N time units */ time?: '5m' | '30m' | '6h' | '1d' | '1w' | '1month' | '1y'; /** * End time for logs (epoch timestamp in milliseconds) */ to?: number | null; /** * Filter logs by user ID */ userId?: string; } export namespace TriggerListParams { export interface SearchParam { field?: string; operation?: string; value?: string; } } export declare namespace Triggers { export { type TriggerRetrieveResponse as TriggerRetrieveResponse, type TriggerListResponse as TriggerListResponse, type TriggerListParams as TriggerListParams, }; }