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"; /** * Tracks status of async Rule operations */ export declare class Operation { /** * 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; constructor(payload: any); } 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); } /** * Request body for PATCH Rule - partially updates the rule. Omit matchType to leave match config unchanged (metadata/settings-only update). Include matchType to change match type and value together (requires the companion field for that type). */ export declare class PatchRule { /** * Human-readable name for the Rule */ "friendlyName"?: string; /** * Optional description of the Rule\'s purpose and usage */ "description"?: string; "matchType": string; /** * New URL prefix to match, MUST be unique across all prefix match rules and MUST end with `/`. */ "prefix": string; /** * Settings to apply with traffic distribution (percentages must sum to 100) */ "settings"?: Array; /** * New exact URL to match, MUST be unique across all exact match rules and MUST NOT end with `/`. */ "value": string; constructor(payload: any); } /** * Request body for creating a new Rule. Uses discriminator on matchType - each type has different required fields. */ export declare class PostRule { /** * Human-readable name for the Rule (optional, defaults to blank) */ "friendlyName"?: string | null; /** * Optional description of the Rule\'s purpose and usage */ "description"?: string; "matchType": string; /** * Settings to apply with traffic distribution (percentages must sum to 100) */ "settings": Array; /** * URL prefix to match, MUST be unique across all prefix match rules and MUST end with `/`. */ "prefix": string; /** * Exact URL to match, MUST be unique across all exact match rules and MUST NOT end with `/`. */ "value": string; constructor(payload: any); } /** * URL matching rule that applies Settings to webhook requests. Rules are discriminated by matchType - each type has different required fields. */ export declare class Rule { /** * Unique Rule identifier (TypeID/TTID format) */ "id": string; /** * Human-readable name for identification */ "friendlyName"?: string; /** * Optional description of the Rule\'s purpose and usage */ "description"?: string; "matchType": string; /** * Settings to apply with traffic distribution (percentages must sum to 100) */ "settings": Array; "createdAt"?: Date; "updatedAt"?: Date; /** * URL prefix to match. Must be unique - only one rule per prefix allowed. Example: \'https://api.example.com/webhooks/\' */ "prefix": string; /** * Exact URL to match. Must be unique - only one rule per value allowed. Example: \'https://api.example.com/webhooks/voice/incoming\' */ "value": string; constructor(payload: any); } /** * Reference to a Setting with traffic percentage */ export declare class SettingReference { /** * Setting resource ID (TypeID format) */ "settingId": string; /** * Percentage of traffic to route (all settings in rule must sum to 100) */ "percentage": number; constructor(payload: any); } /** * Options to pass to remove a RuleInstance */ export interface RuleContextRemoveOptions { /** Idempotency key for mutation operations. Must be a UUIDv7 (other UUID versions are rejected with a 400). */ idempotencyKey?: string; } /** * Options to pass to patch a RuleInstance */ export interface RuleContextPatchOptions { /** */ patchRule: PatchRule; /** Idempotency key for mutation operations. Must be a UUIDv7 (other UUID versions are rejected with a 400). */ idempotencyKey?: string; } /** * Options to pass to create a RuleInstance */ export interface RuleListInstanceCreateOptions { /** */ postRule: PostRule; /** Idempotency key for mutation operations. Must be a UUIDv7 (other UUID versions are rejected with a 400). */ idempotencyKey?: string; } /** * Options to pass to each */ export interface RuleListInstanceEachOptions { /** Number of items per page (max 100, reflecting the 50-resource account limit per resource type) */ pageSize?: number; /** Token for pagination */ pageToken?: string; /** Filter Rules that reference this Setting ID */ settingId?: string; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: RuleInstance, 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 RuleListInstanceOptions { /** Number of items per page (max 100, reflecting the 50-resource account limit per resource type) */ pageSize?: number; /** Token for pagination */ pageToken?: string; /** Filter Rules that reference this Setting ID */ settingId?: 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 RuleListInstancePageOptions { /** Number of items per page (max 100, reflecting the 50-resource account limit per resource type) */ pageSize?: number; /** Token for pagination */ pageToken?: string; /** Filter Rules that reference this Setting ID */ settingId?: string; } export interface RuleContext { /** * Remove a RuleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance */ remove(callback?: (error: Error | null, item?: RuleInstance) => any): Promise; /** * Remove a RuleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance */ remove(params: RuleContextRemoveOptions, callback?: (error: Error | null, item?: RuleInstance) => any): Promise; /** * Remove a RuleInstance and return HTTP info * * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance with HTTP metadata */ removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Remove a RuleInstance and return HTTP info * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance with HTTP metadata */ removeWithHttpInfo(params: RuleContextRemoveOptions, callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Fetch a RuleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance */ fetch(callback?: (error: Error | null, item?: RuleInstance) => any): Promise; /** * Fetch a RuleInstance and return HTTP info * * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance with HTTP metadata */ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Patch a RuleInstance * * @param params - Body for request * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance */ patch(params: PatchRule, headers?: any, callback?: (error: Error | null, item?: RuleInstance) => any): Promise; /** * Patch a RuleInstance and return HTTP info * * @param params - Body for request * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance with HTTP metadata */ patchWithHttpInfo(params: PatchRule, headers?: any, callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RuleContextSolution { ruleId: string; } export declare class RuleContextImpl implements RuleContext { protected _version: V1; protected _solution: RuleContextSolution; protected _uri: string; constructor(_version: V1, ruleId: string); remove(params?: RuleContextRemoveOptions | ((error: Error | null, item?: RuleInstance) => any), callback?: (error: Error | null, item?: RuleInstance) => any): Promise; removeWithHttpInfo(params?: RuleContextRemoveOptions | ((error: Error | null, item?: ApiResponse) => any), callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; fetch(callback?: (error: Error | null, item?: RuleInstance) => any): Promise; fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; patch(params: PatchRule, headers?: any, callback?: (error: Error | null, item?: RuleInstance) => any): Promise; patchWithHttpInfo(params: PatchRule, headers?: any, callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RuleContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } /** * Nested model for Operation */ export interface Operation { id: string; statusUrl: string; status: string; error?: OperationError; resourceId?: string; createdAt: Date; completedAt?: Date; retentionPeriod: string; } /** * Nested model for OperationError */ export interface OperationError { type: string; title: string; code: number; detail: string; } /** * Nested model for PatchRule */ export interface PatchRule { friendlyName?: string; description?: string; matchType: string; prefix: string; settings?: Array; value: string; } /** * Nested model for PostRule */ export interface PostRule { friendlyName?: string | null; description?: string; matchType: string; settings: Array; prefix: string; value: string; } /** * Nested model for Rule */ export interface Rule { id: string; friendlyName?: string; description?: string; matchType: string; settings: Array; createdAt?: Date; updatedAt?: Date; prefix: string; value: string; } /** * Nested model for SettingReference */ export interface SettingReference { settingId: string; percentage: number; } interface RulePayload extends TokenPaginationPayload { rules: RuleResource[]; } /** * Response model for RuleOperationResponse operations */ interface RuleOperationResponse_ResponseResource { operation: Operation; rule?: Rule; } /** * Response model for Rule operations */ interface Rule_ResponseResource { id: string; friendlyName?: string; description?: string; matchType: string; settings: Array; createdAt?: Date; updatedAt?: Date; prefix: string; value: string; } /** * Union type for all possible response models */ type RuleResource = RuleOperationResponse_ResponseResource | Rule_ResponseResource; /** * Response body for async Rule operations (202 Accepted). Contains the Operation tracking object and, for create/update, the Rule state. For delete operations, `rule` is omitted since the resource is being removed. */ export declare class RuleInstance { protected _version: V1; protected _solution: RuleContextSolution; protected _context?: RuleContext; constructor(_version: V1, _payload: RuleResource, ruleId?: string); /** * Operation tracking object — poll statusUrl for completion */ operation?: Operation; /** * State of the Rule resource at the time the operation was accepted (omitted for DELETE) */ rule?: Rule; /** * Unique Rule identifier (TypeID/TTID format) */ id?: string; /** * Human-readable name for identification */ friendlyName?: string; /** * Optional description of the Rule\'s purpose and usage */ description?: string; matchType?: string; /** * Settings to apply with traffic distribution (percentages must sum to 100) */ settings?: Array; createdAt?: Date; updatedAt?: Date; /** * URL prefix to match. Must be unique - only one rule per prefix allowed. Example: \'https://api.example.com/webhooks/\' */ prefix?: string; /** * Exact URL to match. Must be unique - only one rule per value allowed. Example: \'https://api.example.com/webhooks/voice/incoming\' */ value?: string; private get _proxy(); /** * Remove a RuleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance */ remove(callback?: (error: Error | null, item?: RuleInstance) => any): Promise; /** * Remove a RuleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance */ remove(params: RuleContextRemoveOptions, callback?: (error: Error | null, item?: RuleInstance) => any): Promise; /** * Remove a RuleInstance and return HTTP info * * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance with HTTP metadata */ removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Remove a RuleInstance and return HTTP info * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance with HTTP metadata */ removeWithHttpInfo(params: RuleContextRemoveOptions, callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Fetch a RuleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance */ fetch(callback?: (error: Error | null, item?: RuleInstance) => any): Promise; /** * Fetch a RuleInstance and return HTTP info * * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance with HTTP metadata */ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Patch a RuleInstance * * @param params - Body for request * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance */ patch(params: PatchRule, headers?: any, callback?: (error: Error | null, item?: RuleInstance) => any): Promise; /** * Patch a RuleInstance and return HTTP info * * @param params - Body for request * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance with HTTP metadata */ patchWithHttpInfo(params: PatchRule, headers?: any, callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { operation: Operation; rule: Rule; id: string; friendlyName: string; description: string; matchType: string; settings: SettingReference[]; createdAt: Date; updatedAt: Date; prefix: string; value: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RuleSolution { } export interface RuleListInstance { _version: V1; _solution: RuleSolution; _uri: string; (ruleId: string): RuleContext; get(ruleId: string): RuleContext; /** * Create a RuleInstance * * @param params - Body for request * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance */ create(params: PostRule, headers?: any, callback?: (error: Error | null, item?: RuleInstance) => any): Promise; /** * Create a RuleInstance and return HTTP info * * @param params - Body for request * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RuleInstance with HTTP metadata */ createWithHttpInfo(params: PostRule, headers?: any, callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Streams RuleInstance 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 { RuleListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RuleInstance, done: (err?: Error) => void) => void): void; each(params: RuleListInstanceEachOptions, callback?: (item: RuleInstance, done: (err?: Error) => void) => void): void; /** * Streams RuleInstance 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 { RuleListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ eachWithHttpInfo(callback?: (item: RuleInstance, done: (err?: Error) => void) => void): void; eachWithHttpInfo(params: RuleListInstanceEachOptions, callback?: (item: RuleInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RuleInstance 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: RulePage) => any): Promise; /** * Retrieve a single target page of RuleInstance 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 RuleInstance 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 { RuleListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RuleInstance[]) => any): Promise; list(params: RuleListInstanceOptions, callback?: (error: Error | null, items: RuleInstance[]) => any): Promise; /** * Lists RuleInstance 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 { RuleListInstanceOptions } [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: RuleListInstanceOptions, callback?: (error: Error | null, items: ApiResponse) => any): Promise>; /** * Retrieve a single page of RuleInstance 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 { RuleListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RulePage) => any): Promise; page(params: RuleListInstancePageOptions, callback?: (error: Error | null, items: RulePage) => any): Promise; /** * Retrieve a single page of RuleInstance 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 { RuleListInstancePageOptions } [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: RuleListInstancePageOptions, 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 RuleListInstance(version: V1): RuleListInstance; export declare class RulePage extends TokenPage { /** * Initialize the RulePage * * @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: RuleSolution); /** * Build an instance of RuleInstance * * @param payload - Payload response from the API */ getInstance(payload: RuleResource): RuleInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {};