import { inspect, InspectOptions } from "util"; import TokenPage, { TokenPaginationPayload } from "../../../base/TokenPage"; import Response from "../../../http/response"; import V1 from "../V1"; import { ApiResponse } from "../../../base/ApiResponse"; export declare class OperationError { /** * URI identifying the problem type */ "type": string; /** * Short human-readable summary of the problem type */ "title": string; /** * Twilio-specific numeric error code */ "code": number; /** * Human-readable explanation specific to this occurrence */ "detail": string; constructor(payload: any); } /** * Options to pass to each */ export interface OperationListInstanceEachOptions { /** Number of items per page (max 100, reflecting the 50-resource account limit per resource type) */ pageSize?: number; /** Token for pagination */ pageToken?: string; /** Filter by operation state */ status?: "PENDING" | "RUNNING" | "COMPLETED" | "CANCELLED" | "FAILED"; /** Filter operations affecting a specific resource ID */ resourceId?: string; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: OperationInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface OperationListInstanceOptions { /** Number of items per page (max 100, reflecting the 50-resource account limit per resource type) */ pageSize?: number; /** Token for pagination */ pageToken?: string; /** Filter by operation state */ status?: "PENDING" | "RUNNING" | "COMPLETED" | "CANCELLED" | "FAILED"; /** Filter operations affecting a specific resource ID */ resourceId?: string; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface OperationListInstancePageOptions { /** Number of items per page (max 100, reflecting the 50-resource account limit per resource type) */ pageSize?: number; /** Token for pagination */ pageToken?: string; /** Filter by operation state */ status?: "PENDING" | "RUNNING" | "COMPLETED" | "CANCELLED" | "FAILED"; /** Filter operations affecting a specific resource ID */ resourceId?: string; } export interface OperationContext { /** * Fetch a OperationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperationInstance */ fetch(callback?: (error: Error | null, item?: OperationInstance) => any): Promise; /** * Fetch a OperationInstance and return HTTP info * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperationInstance with HTTP metadata */ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface OperationContextSolution { operationId: string; } export declare class OperationContextImpl implements OperationContext { protected _version: V1; protected _solution: OperationContextSolution; protected _uri: string; constructor(_version: V1, operationId: string); fetch(callback?: (error: Error | null, item?: OperationInstance) => any): Promise; fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): OperationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface OperationPayload extends TokenPaginationPayload { operations: OperationResource[]; } interface OperationResource { id: string; statusUrl: string; status: string; error: OperationError; resourceId: string; createdAt: Date; completedAt: Date; retentionPeriod: string; } /** * Tracks status of async Rule operations */ export declare class OperationInstance { protected _version: V1; protected _solution: OperationContextSolution; protected _context?: OperationContext; constructor(_version: V1, _payload: OperationResource, operationId?: string); /** * Unique operation identifier (TypeID/TTID format) */ id: string; /** * URL to poll for operation status (same as Location header in 202 response) */ statusUrl: string; /** * Current state of the operation: - PENDING: Accepted, not yet started - RUNNING: Propagating to all regions (typically 30-60 seconds) - COMPLETED: Rule active globally - CANCELLED: Operation was cancelled before completion - FAILED: Operation could not complete; see error field for details */ status: string; /** * Present only when status is FAILED */ error: OperationError; /** * ID of the affected resource */ resourceId: string; createdAt: Date; completedAt: Date; /** * ISO-8601 duration for how long this Operation record is retained after creation (fixed at 7 days) */ retentionPeriod: string; private get _proxy(); /** * Fetch a OperationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperationInstance */ fetch(callback?: (error: Error | null, item?: OperationInstance) => any): Promise; /** * Fetch a OperationInstance and return HTTP info * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperationInstance with HTTP metadata */ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { id: string; statusUrl: string; status: string; error: OperationError; resourceId: string; createdAt: Date; completedAt: Date; retentionPeriod: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface OperationSolution { } export interface OperationListInstance { _version: V1; _solution: OperationSolution; _uri: string; (operationId: string): OperationContext; get(operationId: string): OperationContext; /** * Streams OperationInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { OperationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: OperationInstance, done: (err?: Error) => void) => void): void; each(params: OperationListInstanceEachOptions, callback?: (item: OperationInstance, done: (err?: Error) => void) => void): void; /** * Streams OperationInstance records from the API with HTTP metadata captured per page. * * This operation lazily loads records as efficiently as possible until the limit * is reached. HTTP metadata (status code, headers) is captured for each page request. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { OperationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ eachWithHttpInfo(callback?: (item: OperationInstance, done: (err?: Error) => void) => void): void; eachWithHttpInfo(params: OperationListInstanceEachOptions, callback?: (item: OperationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of OperationInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: OperationPage) => any): Promise; /** * Retrieve a single target page of OperationInstance records from the API with HTTP metadata. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records with metadata */ getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse) => any): Promise>; /** * Lists OperationInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { OperationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: OperationInstance[]) => any): Promise; list(params: OperationListInstanceOptions, callback?: (error: Error | null, items: OperationInstance[]) => any): Promise; /** * Lists OperationInstance records from the API as a list with HTTP metadata. * * Returns all records along with HTTP metadata from the first page fetched. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { OperationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records with metadata */ listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse) => any): Promise>; listWithHttpInfo(params: OperationListInstanceOptions, callback?: (error: Error | null, items: ApiResponse) => any): Promise>; /** * Retrieve a single page of OperationInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { OperationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: OperationPage) => any): Promise; page(params: OperationListInstancePageOptions, callback?: (error: Error | null, items: OperationPage) => any): Promise; /** * Retrieve a single page of OperationInstance records from the API with HTTP metadata. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { OperationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records with metadata */ pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse) => any): Promise>; pageWithHttpInfo(params: OperationListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse) => any): Promise>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function OperationListInstance(version: V1): OperationListInstance; export declare class OperationPage extends TokenPage { /** * Initialize the OperationPage * * @param version - Version of the resource * @param response - Response from the API * @param uri - URI of the resource * @param params - Query parameters * @param solution - Path solution */ constructor(version: V1, response: Response, uri: string, params: any, solution: OperationSolution); /** * Build an instance of OperationInstance * * @param payload - Payload response from the API */ getInstance(payload: OperationResource): OperationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {};