import { inspect, InspectOptions } from "util"; import TokenPage, { TokenPaginationPayload } from "../../../base/TokenPage"; import Response from "../../../http/response"; import V3 from "../V3"; import { ApiResponse } from "../../../base/ApiResponse"; export declare class InsightsQueryRequest { /** * The business domain to execute the query against */ "domain"?: string; "query": QueryDefinition; constructor(payload: any); } /** * The valid status values for long-running operations. */ export type LongRunningOperationStatus = "PENDING" | "RUNNING" | "CANCELLED" | "COMPLETED" | "FAILED"; /** * The error details for a failed operation, embedded inside a 200 OK operation envelope. */ export declare class OperationError { /** * Twilio-specific error code */ "code": number; /** * A human readable error message */ "message": string; /** * HTTP status code that would have been returned for a synchronous failure */ "httpStatusCode": number; /** * Additional context about the failure */ "detail"?: string | null; constructor(payload: any); } /** * Structured query definition that specifies what data to retrieve and how to filter, group, and order it */ export declare class QueryDefinition { /** * Array of measures to retrieve, representing quantitative values or metrics to be calculated */ "measures"?: Array; /** * Array of dimensions to retrieve, representing categorical attributes for grouping and organizing data */ "dimensions"?: Array; /** * Nested filter conditions. Always use `op` and `expressions`. */ "filters"?: Array; /** * Specifications for sorting the query results by specific fields in ascending or descending order */ "orderBy"?: Array; constructor(payload: any); } export declare class QueryDefinitionFilters { "op"?: string; "expressions": Array; constructor(payload: any); } export declare class QueryDefinitionFiltersExpressions { "op": string; "field": string; "values"?: Array; constructor(payload: any); } export declare class QueryDefinitionOrderBy { /** * Dimension or measure to order by */ "field"?: string; /** * Sort order direction, ascending or descending */ "direction"?: string; constructor(payload: any); } /** * Options to pass to create a QueryJobInstance */ export interface QueryJobListInstanceCreateOptions { /** */ insightsQueryRequest: InsightsQueryRequest; /** A client-generated UUIDv7 key that ensures idempotent behavior. Submitting the same key with an identical request returns the same operation without re-execution. Scoped to Account + Region. Retained for 24 hours. */ idempotencyKey?: string; } /** * Options to pass to each */ export interface QueryJobListInstanceEachOptions { /** The maximum number of resources to return */ pageSize?: number; /** Token for pagination */ pageToken?: string; /** The operation status to filter results by. */ status?: LongRunningOperationStatus; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: QueryJobInstance, 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 QueryJobListInstanceOptions { /** The maximum number of resources to return */ pageSize?: number; /** Token for pagination */ pageToken?: string; /** The operation status to filter results by. */ status?: LongRunningOperationStatus; /** 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 QueryJobListInstancePageOptions { /** The maximum number of resources to return */ pageSize?: number; /** Token for pagination */ pageToken?: string; /** The operation status to filter results by. */ status?: LongRunningOperationStatus; } export interface QueryJobContext { /** * Fetch a QueryJobInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed QueryJobInstance */ fetch(callback?: (error: Error | null, item?: QueryJobInstance) => any): Promise; /** * Fetch a QueryJobInstance and return HTTP info * * @param callback - Callback to handle processed record * * @returns Resolves to processed QueryJobInstance 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 QueryJobContextSolution { operationId: string; } export declare class QueryJobContextImpl implements QueryJobContext { protected _version: V3; protected _solution: QueryJobContextSolution; protected _uri: string; constructor(_version: V3, operationId: string); fetch(callback?: (error: Error | null, item?: QueryJobInstance) => any): Promise; fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): QueryJobContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } /** * Nested model for InsightsQueryRequest */ export interface InsightsQueryRequest { domain?: string; query: QueryDefinition; } /** * Nested model for OperationError */ export interface OperationError { code: number; message: string; httpStatusCode: number; detail?: string | null; } /** * Nested model for QueryDefinition */ export interface QueryDefinition { measures?: Array; dimensions?: Array; filters?: Array; orderBy?: Array; } /** * Nested model for QueryDefinitionFilters */ export interface QueryDefinitionFilters { op?: string; expressions: Array; } /** * Nested model for QueryDefinitionFiltersExpressions */ export interface QueryDefinitionFiltersExpressions { op: string; field: string; values?: Array; } /** * Nested model for QueryDefinitionOrderBy */ export interface QueryDefinitionOrderBy { field?: string; direction?: string; } interface QueryJobPayload extends TokenPaginationPayload { items: QueryJobResource[]; } /** * Response model for QueryJobStatusResponse operations */ interface QueryJobStatusResponse_ResponseResource { operationId: string; status: LongRunningOperationStatus; statusUrl?: string; createdAt: Date; completedAt?: Date; error?: OperationError; resultUrl?: string; resultId?: string; resultRetentionPeriod?: string; } /** * Response model for QueryJobSubmitResponse operations */ interface QueryJobSubmitResponse_ResponseResource { operationId: string; status: LongRunningOperationStatus; statusUrl: string; createdAt: Date; } /** * Union type for all possible response models */ type QueryJobResource = QueryJobStatusResponse_ResponseResource | QueryJobSubmitResponse_ResponseResource; /** * The initial 202 response for an async query submission. Conforms to LongRunningOperation202Response from Twilio API Standards. */ export declare class QueryJobInstance { protected _version: V3; protected _solution: QueryJobContextSolution; protected _context?: QueryJobContext; constructor(_version: V3, _payload: QueryJobResource, operationId?: string); /** * The unique identifier for the asynchronous query operation, in TTID format. */ operationId?: string; status?: LongRunningOperationStatus; statusUrl?: string; createdAt?: Date; /** * The time when the operation reached a terminal state (CANCELLED, COMPLETED, or FAILED), in RFC 3339 UTC format. Null while the operation is still PENDING or RUNNING. */ completedAt?: Date; /** * The error details, present only when status is FAILED. */ error?: OperationError; /** * The URL to retrieve query results, present only when status is COMPLETED. Supports pagination via the pageSize and pageToken query parameters. */ resultUrl?: string; /** * The identifier of the results resource, present only when status is COMPLETED. Equal to operationId, since results are keyed by the operation ID. */ resultId?: string; /** * The duration for how long results are retained, in ISO 8601 format. */ resultRetentionPeriod?: string; private get _proxy(); /** * Fetch a QueryJobInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed QueryJobInstance */ fetch(callback?: (error: Error | null, item?: QueryJobInstance) => any): Promise; /** * Fetch a QueryJobInstance and return HTTP info * * @param callback - Callback to handle processed record * * @returns Resolves to processed QueryJobInstance with HTTP metadata */ fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { operationId: string; status: LongRunningOperationStatus; statusUrl: string; createdAt: Date; completedAt: Date; error: OperationError; resultUrl: string; resultId: string; resultRetentionPeriod: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface QueryJobSolution { } export interface QueryJobListInstance { _version: V3; _solution: QueryJobSolution; _uri: string; (operationId: string): QueryJobContext; get(operationId: string): QueryJobContext; /** * Create a QueryJobInstance * * @param params - Body for request * @param headers - header params for request * @param callback - Callback to handle processed record * * @returns Resolves to processed QueryJobInstance */ create(params: InsightsQueryRequest, headers?: any, callback?: (error: Error | null, item?: QueryJobInstance) => any): Promise; /** * Create a QueryJobInstance 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 QueryJobInstance with HTTP metadata */ createWithHttpInfo(params: InsightsQueryRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse) => any): Promise>; /** * Streams QueryJobInstance 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 { QueryJobListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: QueryJobInstance, done: (err?: Error) => void) => void): void; each(params: QueryJobListInstanceEachOptions, callback?: (item: QueryJobInstance, done: (err?: Error) => void) => void): void; /** * Streams QueryJobInstance 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 { QueryJobListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ eachWithHttpInfo(callback?: (item: QueryJobInstance, done: (err?: Error) => void) => void): void; eachWithHttpInfo(params: QueryJobListInstanceEachOptions, callback?: (item: QueryJobInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of QueryJobInstance 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: QueryJobPage) => any): Promise; /** * Retrieve a single target page of QueryJobInstance 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 QueryJobInstance 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 { QueryJobListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: QueryJobInstance[]) => any): Promise; list(params: QueryJobListInstanceOptions, callback?: (error: Error | null, items: QueryJobInstance[]) => any): Promise; /** * Lists QueryJobInstance 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 { QueryJobListInstanceOptions } [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: QueryJobListInstanceOptions, callback?: (error: Error | null, items: ApiResponse) => any): Promise>; /** * Retrieve a single page of QueryJobInstance 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 { QueryJobListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: QueryJobPage) => any): Promise; page(params: QueryJobListInstancePageOptions, callback?: (error: Error | null, items: QueryJobPage) => any): Promise; /** * Retrieve a single page of QueryJobInstance 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 { QueryJobListInstancePageOptions } [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: QueryJobListInstancePageOptions, 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 QueryJobListInstance(version: V3): QueryJobListInstance; export declare class QueryJobPage extends TokenPage { /** * Initialize the QueryJobPage * * @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: V3, response: Response, uri: string, params: any, solution: QueryJobSolution); /** * Build an instance of QueryJobInstance * * @param payload - Payload response from the API */ getInstance(payload: QueryJobResource): QueryJobInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {};