/// import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { AssetListInstance } from "./service/asset"; import { BuildListInstance } from "./service/build"; import { EnvironmentListInstance } from "./service/environment"; import { FunctionListInstance } from "./service/function"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** Whether to inject Account credentials into a function invocation context. */ includeCredentials?: boolean; /** A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. */ friendlyName?: string; /** Whether the Service resource\\\'s properties and subresources can be edited via the UI. The default value is `false`. */ uiEditable?: boolean; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** A user-defined string that uniquely identifies the Service resource. It can be used as an alternative to the `sid` in the URL path to address the Service resource. This value must be 50 characters or less in length and be unique. */ uniqueName: string; /** A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. */ friendlyName: string; /** Whether to inject Account credentials into a function invocation context. The default value is `true`. */ includeCredentials?: boolean; /** Whether the Service\\\'s properties and subresources can be edited via the UI. The default value is `false`. */ uiEditable?: boolean; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { assets: AssetListInstance; builds: BuildListInstance; environments: EnvironmentListInstance; functions: FunctionListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V1; protected _solution: ServiceContextSolution; protected _uri: string; protected _assets?: AssetListInstance; protected _builds?: BuildListInstance; protected _environments?: EnvironmentListInstance; protected _functions?: FunctionListInstance; constructor(_version: V1, sid: string); get assets(): AssetListInstance; get builds(): BuildListInstance; get environments(): EnvironmentListInstance; get functions(): FunctionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; unique_name: string; include_credentials: boolean; ui_editable: boolean; domain_base: string; date_created: Date; date_updated: Date; url: string; links: Record; } export declare class ServiceInstance { protected _version: V1; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V1, payload: ServiceResource, sid?: string); /** * The unique string that we created to identify the Service resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. */ accountSid: string; /** * The string that you assigned to describe the Service resource. */ friendlyName: string; /** * A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource\'s `sid` in the URL to address the Service resource. */ uniqueName: string; /** * Whether to inject Account credentials into a function invocation context. */ includeCredentials: boolean; /** * Whether the Service resource\'s properties and subresources can be edited via the UI. */ uiEditable: boolean; /** * The base domain name for this Service, which is a combination of the unique name and a randomly generated string. */ domainBase: string; /** * The date and time in GMT when the Service resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the Service resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Service resource. */ url: string; /** * The URLs of the Service\'s nested resources. */ links: Record; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise; /** * Access the assets. */ assets(): AssetListInstance; /** * Access the builds. */ builds(): BuildListInstance; /** * Access the environments. */ environments(): EnvironmentListInstance; /** * Access the functions. */ functions(): FunctionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; uniqueName: string; includeCredentials: boolean; uiEditable: boolean; domainBase: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V1; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V1): ServiceListInstance; export declare class ServicePage extends Page { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {};