twilio
Version:
A Twilio helper library
150 lines (149 loc) • 5.81 kB
TypeScript
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../../base/Page";
import Response from "../../../../../http/response";
import V2010 from "../../../V2010";
/**
* Options to pass to each
*/
export interface EventListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: EventInstance, 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 EventListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** 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 EventListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface EventSolution {
accountSid: string;
callSid: string;
}
export interface EventListInstance {
_version: V2010;
_solution: EventSolution;
_uri: string;
/**
* Streams EventInstance 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 { EventListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: EventInstance, done: (err?: Error) => void) => void): void;
each(params: EventListInstanceEachOptions, callback?: (item: EventInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of EventInstance 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: EventPage) => any): Promise<EventPage>;
/**
* Lists EventInstance 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 { EventListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>;
list(params: EventListInstanceOptions, callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>;
/**
* Retrieve a single page of EventInstance 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 { EventListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>;
page(params: EventListInstancePageOptions, callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function EventListInstance(version: V2010, accountSid: string, callSid: string): EventListInstance;
interface EventPayload extends TwilioResponsePayload {
events: EventResource[];
}
interface EventResource {
request: any;
response: any;
}
export declare class EventInstance {
protected _version: V2010;
constructor(_version: V2010, payload: EventResource, accountSid: string, callSid: string);
/**
* Contains a dictionary representing the request of the call.
*/
request: any;
/**
* Contains a dictionary representing the call response, including a list of the call events.
*/
response: any;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
request: any;
response: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class EventPage extends Page<V2010, EventPayload, EventResource, EventInstance> {
/**
* Initialize the EventPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2010, response: Response<string>, solution: EventSolution);
/**
* Build an instance of EventInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: EventResource): EventInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};