Auto-commit 2026-04-29 16:31

This commit is contained in:
2026-04-29 16:31:27 -04:00
parent e8687bb6b2
commit 0495ee5bd2
19691 changed files with 3272886 additions and 138 deletions

15
node_modules/twilio/lib/rest/trunking/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import TrunkingBase from "../TrunkingBase";
import Version from "../../base/Version";
import { TrunkListInstance } from "./v1/trunk";
export default class V1 extends Version {
/**
* Initialize the V1 version of Trunking
*
* @param domain - The Twilio (Twilio.Trunking) domain
*/
constructor(domain: TrunkingBase);
/** trunks - { Twilio.Trunking.V1.TrunkListInstance } resource */
protected _trunks?: TrunkListInstance;
/** Getter for trunks resource */
get trunks(): TrunkListInstance;
}

36
node_modules/twilio/lib/rest/trunking/V1.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trunking
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Version_1 = __importDefault(require("../../base/Version"));
const trunk_1 = require("./v1/trunk");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Trunking
*
* @param domain - The Twilio (Twilio.Trunking) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for trunks resource */
get trunks() {
this._trunks = this._trunks || (0, trunk_1.TrunkListInstance)(this);
return this._trunks;
}
}
exports.default = V1;

580
node_modules/twilio/lib/rest/trunking/v1/trunk.d.ts generated vendored Normal file
View File

@@ -0,0 +1,580 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { CredentialListListInstance } from "./trunk/credentialList";
import { IpAccessControlListListInstance } from "./trunk/ipAccessControlList";
import { OriginationUrlListInstance } from "./trunk/originationUrl";
import { PhoneNumberListInstance } from "./trunk/phoneNumber";
import { RecordingListInstance } from "./trunk/recording";
/**
* Caller Id for transfer target. Can be: `from-transferee` (default) or `from-transferor`.
*/
export type TrunkTransferCallerId = "from-transferee" | "from-transferor";
/**
* The call transfer settings for the trunk. Can be: `enable-all`, `sip-only` and `disable-all`. See [Transfer](https://www.twilio.com/docs/sip-trunking/call-transfer) for more information.
*/
export type TrunkTransferSetting = "disable-all" | "enable-all" | "sip-only";
/**
* Options to pass to update a TrunkInstance
*/
export interface TrunkContextUpdateOptions {
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName?: string;
/** The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. */
domainName?: string;
/** The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. */
disasterRecoveryUrl?: string;
/** The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. */
disasterRecoveryMethod?: string;
/** */
transferMode?: TrunkTransferSetting;
/** Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. */
secure?: boolean;
/** Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. */
cnamLookupEnabled?: boolean;
/** */
transferCallerId?: TrunkTransferCallerId;
}
/**
* Options to pass to create a TrunkInstance
*/
export interface TrunkListInstanceCreateOptions {
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName?: string;
/** The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. */
domainName?: string;
/** The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. */
disasterRecoveryUrl?: string;
/** The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. */
disasterRecoveryMethod?: string;
/** */
transferMode?: TrunkTransferSetting;
/** Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. */
secure?: boolean;
/** Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. */
cnamLookupEnabled?: boolean;
/** */
transferCallerId?: TrunkTransferCallerId;
}
/**
* Options to pass to each
*/
export interface TrunkListInstanceEachOptions {
/** 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: TrunkInstance, 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 TrunkListInstanceOptions {
/** 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 TrunkListInstancePageOptions {
/** 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 TrunkContext {
credentialsLists: CredentialListListInstance;
ipAccessControlLists: IpAccessControlListListInstance;
originationUrls: OriginationUrlListInstance;
phoneNumbers: PhoneNumberListInstance;
recordings: RecordingListInstance;
/**
* Remove a TrunkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TrunkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a TrunkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance
*/
fetch(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
/**
* Fetch a TrunkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
/**
* Update a TrunkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance
*/
update(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
/**
* Update a TrunkInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance
*/
update(params: TrunkContextUpdateOptions, callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
/**
* Update a TrunkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
/**
* Update a TrunkInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance with HTTP metadata
*/
updateWithHttpInfo(params: TrunkContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface TrunkContextSolution {
sid: string;
}
export declare class TrunkContextImpl implements TrunkContext {
protected _version: V1;
protected _solution: TrunkContextSolution;
protected _uri: string;
protected _credentialsLists?: CredentialListListInstance;
protected _ipAccessControlLists?: IpAccessControlListListInstance;
protected _originationUrls?: OriginationUrlListInstance;
protected _phoneNumbers?: PhoneNumberListInstance;
protected _recordings?: RecordingListInstance;
constructor(_version: V1, sid: string);
get credentialsLists(): CredentialListListInstance;
get ipAccessControlLists(): IpAccessControlListListInstance;
get originationUrls(): OriginationUrlListInstance;
get phoneNumbers(): PhoneNumberListInstance;
get recordings(): RecordingListInstance;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
update(params?: TrunkContextUpdateOptions | ((error: Error | null, item?: TrunkInstance) => any), callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
updateWithHttpInfo(params?: TrunkContextUpdateOptions | ((error: Error | null, item?: ApiResponse<TrunkInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): TrunkContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface TrunkPayload extends TwilioResponsePayload {
trunks: TrunkResource[];
}
interface TrunkResource {
account_sid: string;
domain_name: string;
disaster_recovery_method: string;
disaster_recovery_url: string;
friendly_name: string;
secure: boolean;
recording: any;
transfer_mode: TrunkTransferSetting;
transfer_caller_id: TrunkTransferCallerId;
cnam_lookup_enabled: boolean;
auth_type: string;
symmetric_rtp_enabled: boolean;
auth_type_set: Array<string>;
date_created: Date;
date_updated: Date;
sid: string;
url: string;
links: Record<string, string>;
}
export declare class TrunkInstance {
protected _version: V1;
protected _solution: TrunkContextSolution;
protected _context?: TrunkContext;
constructor(_version: V1, payload: TrunkResource, sid?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Trunk resource.
*/
accountSid: string;
/**
* The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information.
*/
domainName: string;
/**
* The HTTP method we use to call the `disaster_recovery_url`. Can be: `GET` or `POST`.
*/
disasterRecoveryMethod: string;
/**
* The URL we call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information.
*/
disasterRecoveryUrl: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information.
*/
secure: boolean;
/**
* The recording settings for the trunk. Can be: `do-not-record`, `record-from-ringing`, `record-from-answer`. If set to `record-from-ringing` or `record-from-answer`, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g.`/Trunks/[Trunk_SID]/Recording -XPOST -d\'Mode=record-from-answer\'`. See [Recording](https://www.twilio.com/docs/sip-trunking#recording) for more information.
*/
recording: any;
transferMode: TrunkTransferSetting;
transferCallerId: TrunkTransferCallerId;
/**
* Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information.
*/
cnamLookupEnabled: boolean;
/**
* The types of authentication mapped to the domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic.
*/
authType: string;
/**
* Whether Symmetric RTP is enabled for the trunk. When Symmetric RTP is disabled, Twilio will send RTP to the destination negotiated in the SDP. Disabling Symmetric RTP is considered to be more secure and therefore recommended. See [Symmetric RTP](https://www.twilio.com/docs/sip-trunking#symmetric-rtp) for more information.
*/
symmetricRtpEnabled: boolean;
/**
* Reserved.
*/
authTypeSet: Array<string>;
/**
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The unique string that we created to identify the Trunk resource.
*/
sid: string;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of related resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Remove a TrunkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TrunkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a TrunkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance
*/
fetch(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
/**
* Fetch a TrunkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
/**
* Update a TrunkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance
*/
update(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
/**
* Update a TrunkInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance
*/
update(params: TrunkContextUpdateOptions, callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
/**
* Update a TrunkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
/**
* Update a TrunkInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance with HTTP metadata
*/
updateWithHttpInfo(params: TrunkContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
/**
* Access the credentialsLists.
*/
credentialsLists(): CredentialListListInstance;
/**
* Access the ipAccessControlLists.
*/
ipAccessControlLists(): IpAccessControlListListInstance;
/**
* Access the originationUrls.
*/
originationUrls(): OriginationUrlListInstance;
/**
* Access the phoneNumbers.
*/
phoneNumbers(): PhoneNumberListInstance;
/**
* Access the recordings.
*/
recordings(): RecordingListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
domainName: string;
disasterRecoveryMethod: string;
disasterRecoveryUrl: string;
friendlyName: string;
secure: boolean;
recording: any;
transferMode: TrunkTransferSetting;
transferCallerId: TrunkTransferCallerId;
cnamLookupEnabled: boolean;
authType: string;
symmetricRtpEnabled: boolean;
authTypeSet: string[];
dateCreated: Date;
dateUpdated: Date;
sid: string;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface TrunkSolution {
}
export interface TrunkListInstance {
_version: V1;
_solution: TrunkSolution;
_uri: string;
(sid: string): TrunkContext;
get(sid: string): TrunkContext;
/**
* Create a TrunkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance
*/
create(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
/**
* Create a TrunkInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance
*/
create(params: TrunkListInstanceCreateOptions, callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>;
/**
* Create a TrunkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
/**
* Create a TrunkInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance with HTTP metadata
*/
createWithHttpInfo(params: TrunkListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<TrunkInstance>) => any): Promise<ApiResponse<TrunkInstance>>;
/**
* Streams TrunkInstance 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 { TrunkListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: TrunkInstance, done: (err?: Error) => void) => void): void;
each(params: TrunkListInstanceEachOptions, callback?: (item: TrunkInstance, done: (err?: Error) => void) => void): void;
/**
* Streams TrunkInstance 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 { TrunkListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: TrunkInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: TrunkListInstanceEachOptions, callback?: (item: TrunkInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of TrunkInstance 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: TrunkPage) => any): Promise<TrunkPage>;
/**
* Retrieve a single target page of TrunkInstance 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<TrunkPage>) => any): Promise<ApiResponse<TrunkPage>>;
/**
* Lists TrunkInstance 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 { TrunkListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: TrunkInstance[]) => any): Promise<TrunkInstance[]>;
list(params: TrunkListInstanceOptions, callback?: (error: Error | null, items: TrunkInstance[]) => any): Promise<TrunkInstance[]>;
/**
* Lists TrunkInstance 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 { TrunkListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrunkInstance[]>) => any): Promise<ApiResponse<TrunkInstance[]>>;
listWithHttpInfo(params: TrunkListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<TrunkInstance[]>) => any): Promise<ApiResponse<TrunkInstance[]>>;
/**
* Retrieve a single page of TrunkInstance 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 { TrunkListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: TrunkPage) => any): Promise<TrunkPage>;
page(params: TrunkListInstancePageOptions, callback?: (error: Error | null, items: TrunkPage) => any): Promise<TrunkPage>;
/**
* Retrieve a single page of TrunkInstance 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 { TrunkListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TrunkPage>) => any): Promise<ApiResponse<TrunkPage>>;
pageWithHttpInfo(params: TrunkListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<TrunkPage>) => any): Promise<ApiResponse<TrunkPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function TrunkListInstance(version: V1): TrunkListInstance;
export declare class TrunkPage extends Page<V1, TrunkPayload, TrunkResource, TrunkInstance> {
/**
* Initialize the TrunkPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: TrunkSolution);
/**
* Build an instance of TrunkInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: TrunkResource): TrunkInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

567
node_modules/twilio/lib/rest/trunking/v1/trunk.js generated vendored Normal file
View File

@@ -0,0 +1,567 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trunking
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TrunkPage = exports.TrunkInstance = exports.TrunkContextImpl = void 0;
exports.TrunkListInstance = TrunkListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const credentialList_1 = require("./trunk/credentialList");
const ipAccessControlList_1 = require("./trunk/ipAccessControlList");
const originationUrl_1 = require("./trunk/originationUrl");
const phoneNumber_1 = require("./trunk/phoneNumber");
const recording_1 = require("./trunk/recording");
class TrunkContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Trunks/${sid}`;
}
get credentialsLists() {
this._credentialsLists =
this._credentialsLists ||
(0, credentialList_1.CredentialListListInstance)(this._version, this._solution.sid);
return this._credentialsLists;
}
get ipAccessControlLists() {
this._ipAccessControlLists =
this._ipAccessControlLists ||
(0, ipAccessControlList_1.IpAccessControlListListInstance)(this._version, this._solution.sid);
return this._ipAccessControlLists;
}
get originationUrls() {
this._originationUrls =
this._originationUrls ||
(0, originationUrl_1.OriginationUrlListInstance)(this._version, this._solution.sid);
return this._originationUrls;
}
get phoneNumbers() {
this._phoneNumbers =
this._phoneNumbers ||
(0, phoneNumber_1.PhoneNumberListInstance)(this._version, this._solution.sid);
return this._phoneNumbers;
}
get recordings() {
this._recordings =
this._recordings ||
(0, recording_1.RecordingListInstance)(this._version, this._solution.sid);
return this._recordings;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new TrunkInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new TrunkInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["domainName"] !== undefined)
data["DomainName"] = params["domainName"];
if (params["disasterRecoveryUrl"] !== undefined)
data["DisasterRecoveryUrl"] = params["disasterRecoveryUrl"];
if (params["disasterRecoveryMethod"] !== undefined)
data["DisasterRecoveryMethod"] = params["disasterRecoveryMethod"];
if (params["transferMode"] !== undefined)
data["TransferMode"] = params["transferMode"];
if (params["secure"] !== undefined)
data["Secure"] = serialize.bool(params["secure"]);
if (params["cnamLookupEnabled"] !== undefined)
data["CnamLookupEnabled"] = serialize.bool(params["cnamLookupEnabled"]);
if (params["transferCallerId"] !== undefined)
data["TransferCallerId"] = params["transferCallerId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new TrunkInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["domainName"] !== undefined)
data["DomainName"] = params["domainName"];
if (params["disasterRecoveryUrl"] !== undefined)
data["DisasterRecoveryUrl"] = params["disasterRecoveryUrl"];
if (params["disasterRecoveryMethod"] !== undefined)
data["DisasterRecoveryMethod"] = params["disasterRecoveryMethod"];
if (params["transferMode"] !== undefined)
data["TransferMode"] = params["transferMode"];
if (params["secure"] !== undefined)
data["Secure"] = serialize.bool(params["secure"]);
if (params["cnamLookupEnabled"] !== undefined)
data["CnamLookupEnabled"] = serialize.bool(params["cnamLookupEnabled"]);
if (params["transferCallerId"] !== undefined)
data["TransferCallerId"] = params["transferCallerId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new TrunkInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrunkContextImpl = TrunkContextImpl;
class TrunkInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.domainName = payload.domain_name;
this.disasterRecoveryMethod = payload.disaster_recovery_method;
this.disasterRecoveryUrl = payload.disaster_recovery_url;
this.friendlyName = payload.friendly_name;
this.secure = payload.secure;
this.recording = payload.recording;
this.transferMode = payload.transfer_mode;
this.transferCallerId = payload.transfer_caller_id;
this.cnamLookupEnabled = payload.cnam_lookup_enabled;
this.authType = payload.auth_type;
this.symmetricRtpEnabled = payload.symmetric_rtp_enabled;
this.authTypeSet = payload.auth_type_set;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.sid = payload.sid;
this.url = payload.url;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context || new TrunkContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a TrunkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a TrunkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a TrunkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a TrunkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TrunkInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the credentialsLists.
*/
credentialsLists() {
return this._proxy.credentialsLists;
}
/**
* Access the ipAccessControlLists.
*/
ipAccessControlLists() {
return this._proxy.ipAccessControlLists;
}
/**
* Access the originationUrls.
*/
originationUrls() {
return this._proxy.originationUrls;
}
/**
* Access the phoneNumbers.
*/
phoneNumbers() {
return this._proxy.phoneNumbers;
}
/**
* Access the recordings.
*/
recordings() {
return this._proxy.recordings;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
domainName: this.domainName,
disasterRecoveryMethod: this.disasterRecoveryMethod,
disasterRecoveryUrl: this.disasterRecoveryUrl,
friendlyName: this.friendlyName,
secure: this.secure,
recording: this.recording,
transferMode: this.transferMode,
transferCallerId: this.transferCallerId,
cnamLookupEnabled: this.cnamLookupEnabled,
authType: this.authType,
symmetricRtpEnabled: this.symmetricRtpEnabled,
authTypeSet: this.authTypeSet,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
sid: this.sid,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrunkInstance = TrunkInstance;
function TrunkListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new TrunkContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Trunks`;
instance.create = function create(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["domainName"] !== undefined)
data["DomainName"] = params["domainName"];
if (params["disasterRecoveryUrl"] !== undefined)
data["DisasterRecoveryUrl"] = params["disasterRecoveryUrl"];
if (params["disasterRecoveryMethod"] !== undefined)
data["DisasterRecoveryMethod"] = params["disasterRecoveryMethod"];
if (params["transferMode"] !== undefined)
data["TransferMode"] = params["transferMode"];
if (params["secure"] !== undefined)
data["Secure"] = serialize.bool(params["secure"]);
if (params["cnamLookupEnabled"] !== undefined)
data["CnamLookupEnabled"] = serialize.bool(params["cnamLookupEnabled"]);
if (params["transferCallerId"] !== undefined)
data["TransferCallerId"] = params["transferCallerId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new TrunkInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["domainName"] !== undefined)
data["DomainName"] = params["domainName"];
if (params["disasterRecoveryUrl"] !== undefined)
data["DisasterRecoveryUrl"] = params["disasterRecoveryUrl"];
if (params["disasterRecoveryMethod"] !== undefined)
data["DisasterRecoveryMethod"] = params["disasterRecoveryMethod"];
if (params["transferMode"] !== undefined)
data["TransferMode"] = params["transferMode"];
if (params["secure"] !== undefined)
data["Secure"] = serialize.bool(params["secure"]);
if (params["cnamLookupEnabled"] !== undefined)
data["CnamLookupEnabled"] = serialize.bool(params["cnamLookupEnabled"]);
if (params["transferCallerId"] !== undefined)
data["TransferCallerId"] = params["transferCallerId"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new TrunkInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new TrunkPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new TrunkPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new TrunkPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new TrunkPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class TrunkPage extends Page_1.default {
/**
* Initialize the TrunkPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of TrunkInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new TrunkInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TrunkPage = TrunkPage;

View File

@@ -0,0 +1,353 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a CredentialListInstance
*/
export interface CredentialListListInstanceCreateOptions {
/** The SID of the [Credential List](https://www.twilio.com/docs/voice/sip/api/sip-credentiallist-resource) that you want to associate with the trunk. Once associated, we will authenticate access to the trunk against this list. */
credentialListSid: string;
}
/**
* Options to pass to each
*/
export interface CredentialListListInstanceEachOptions {
/** 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: CredentialListInstance, 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 CredentialListListInstanceOptions {
/** 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 CredentialListListInstancePageOptions {
/** 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 CredentialListContext {
/**
* Remove a CredentialListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CredentialListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a CredentialListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CredentialListInstance
*/
fetch(callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>;
/**
* Fetch a CredentialListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CredentialListInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CredentialListInstance>) => any): Promise<ApiResponse<CredentialListInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CredentialListContextSolution {
trunkSid: string;
sid: string;
}
export declare class CredentialListContextImpl implements CredentialListContext {
protected _version: V1;
protected _solution: CredentialListContextSolution;
protected _uri: string;
constructor(_version: V1, trunkSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CredentialListInstance>) => any): Promise<ApiResponse<CredentialListInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CredentialListContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CredentialListPayload extends TwilioResponsePayload {
credential_lists: CredentialListResource[];
}
interface CredentialListResource {
account_sid: string;
sid: string;
trunk_sid: string;
friendly_name: string;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class CredentialListInstance {
protected _version: V1;
protected _solution: CredentialListContextSolution;
protected _context?: CredentialListContext;
constructor(_version: V1, payload: CredentialListResource, trunkSid: string, sid?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialList resource.
*/
accountSid: string;
/**
* The unique string that we created to identify the CredentialList resource.
*/
sid: string;
/**
* The SID of the Trunk the credential list in associated with.
*/
trunkSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Remove a CredentialListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CredentialListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a CredentialListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CredentialListInstance
*/
fetch(callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>;
/**
* Fetch a CredentialListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CredentialListInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CredentialListInstance>) => any): Promise<ApiResponse<CredentialListInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
sid: string;
trunkSid: string;
friendlyName: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CredentialListSolution {
trunkSid: string;
}
export interface CredentialListListInstance {
_version: V1;
_solution: CredentialListSolution;
_uri: string;
(sid: string): CredentialListContext;
get(sid: string): CredentialListContext;
/**
* Create a CredentialListInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CredentialListInstance
*/
create(params: CredentialListListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>;
/**
* Create a CredentialListInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CredentialListInstance with HTTP metadata
*/
createWithHttpInfo(params: CredentialListListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<CredentialListInstance>) => any): Promise<ApiResponse<CredentialListInstance>>;
/**
* Streams CredentialListInstance 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 { CredentialListListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CredentialListInstance, done: (err?: Error) => void) => void): void;
each(params: CredentialListListInstanceEachOptions, callback?: (item: CredentialListInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CredentialListInstance 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 { CredentialListListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CredentialListInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CredentialListListInstanceEachOptions, callback?: (item: CredentialListInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CredentialListInstance 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: CredentialListPage) => any): Promise<CredentialListPage>;
/**
* Retrieve a single target page of CredentialListInstance 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<CredentialListPage>) => any): Promise<ApiResponse<CredentialListPage>>;
/**
* Lists CredentialListInstance 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 { CredentialListListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CredentialListInstance[]) => any): Promise<CredentialListInstance[]>;
list(params: CredentialListListInstanceOptions, callback?: (error: Error | null, items: CredentialListInstance[]) => any): Promise<CredentialListInstance[]>;
/**
* Lists CredentialListInstance 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 { CredentialListListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CredentialListInstance[]>) => any): Promise<ApiResponse<CredentialListInstance[]>>;
listWithHttpInfo(params: CredentialListListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CredentialListInstance[]>) => any): Promise<ApiResponse<CredentialListInstance[]>>;
/**
* Retrieve a single page of CredentialListInstance 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 { CredentialListListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CredentialListPage) => any): Promise<CredentialListPage>;
page(params: CredentialListListInstancePageOptions, callback?: (error: Error | null, items: CredentialListPage) => any): Promise<CredentialListPage>;
/**
* Retrieve a single page of CredentialListInstance 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 { CredentialListListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CredentialListPage>) => any): Promise<ApiResponse<CredentialListPage>>;
pageWithHttpInfo(params: CredentialListListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CredentialListPage>) => any): Promise<ApiResponse<CredentialListPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CredentialListListInstance(version: V1, trunkSid: string): CredentialListListInstance;
export declare class CredentialListPage extends Page<V1, CredentialListPayload, CredentialListResource, CredentialListInstance> {
/**
* Initialize the CredentialListPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CredentialListSolution);
/**
* Build an instance of CredentialListInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CredentialListResource): CredentialListInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,367 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trunking
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CredentialListPage = exports.CredentialListInstance = exports.CredentialListContextImpl = void 0;
exports.CredentialListListInstance = CredentialListListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class CredentialListContextImpl {
constructor(_version, trunkSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { trunkSid, sid };
this._uri = `/Trunks/${trunkSid}/CredentialLists/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new CredentialListInstance(operationVersion, payload, instance._solution.trunkSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new CredentialListInstance(operationVersion, response.body, instance._solution.trunkSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CredentialListContextImpl = CredentialListContextImpl;
class CredentialListInstance {
constructor(_version, payload, trunkSid, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.sid = payload.sid;
this.trunkSid = payload.trunk_sid;
this.friendlyName = payload.friendly_name;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { trunkSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new CredentialListContextImpl(this._version, this._solution.trunkSid, this._solution.sid);
return this._context;
}
/**
* Remove a CredentialListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a CredentialListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a CredentialListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CredentialListInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CredentialListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CredentialListInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
sid: this.sid,
trunkSid: this.trunkSid,
friendlyName: this.friendlyName,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CredentialListInstance = CredentialListInstance;
function CredentialListListInstance(version, trunkSid) {
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new CredentialListContextImpl(version, trunkSid, sid);
};
instance._version = version;
instance._solution = { trunkSid };
instance._uri = `/Trunks/${trunkSid}/CredentialLists`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["credentialListSid"] === null ||
params["credentialListSid"] === undefined) {
throw new Error("Required parameter \"params['credentialListSid']\" missing.");
}
let data = {};
data["CredentialListSid"] = params["credentialListSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new CredentialListInstance(operationVersion, payload, instance._solution.trunkSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["credentialListSid"] === null ||
params["credentialListSid"] === undefined) {
throw new Error("Required parameter \"params['credentialListSid']\" missing.");
}
let data = {};
data["CredentialListSid"] = params["credentialListSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new CredentialListInstance(operationVersion, response.body, instance._solution.trunkSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new CredentialListPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new CredentialListPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new CredentialListPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new CredentialListPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class CredentialListPage extends Page_1.default {
/**
* Initialize the CredentialListPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of CredentialListInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CredentialListInstance(this._version, payload, this._solution.trunkSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CredentialListPage = CredentialListPage;

View File

@@ -0,0 +1,353 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a IpAccessControlListInstance
*/
export interface IpAccessControlListListInstanceCreateOptions {
/** The SID of the [IP Access Control List](https://www.twilio.com/docs/voice/sip/api/sip-ipaccesscontrollist-resource) that you want to associate with the trunk. */
ipAccessControlListSid: string;
}
/**
* Options to pass to each
*/
export interface IpAccessControlListListInstanceEachOptions {
/** 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: IpAccessControlListInstance, 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 IpAccessControlListListInstanceOptions {
/** 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 IpAccessControlListListInstancePageOptions {
/** 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 IpAccessControlListContext {
/**
* Remove a IpAccessControlListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a IpAccessControlListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a IpAccessControlListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpAccessControlListInstance
*/
fetch(callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>;
/**
* Fetch a IpAccessControlListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpAccessControlListInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<IpAccessControlListInstance>) => any): Promise<ApiResponse<IpAccessControlListInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface IpAccessControlListContextSolution {
trunkSid: string;
sid: string;
}
export declare class IpAccessControlListContextImpl implements IpAccessControlListContext {
protected _version: V1;
protected _solution: IpAccessControlListContextSolution;
protected _uri: string;
constructor(_version: V1, trunkSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<IpAccessControlListInstance>) => any): Promise<ApiResponse<IpAccessControlListInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): IpAccessControlListContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface IpAccessControlListPayload extends TwilioResponsePayload {
ip_access_control_lists: IpAccessControlListResource[];
}
interface IpAccessControlListResource {
account_sid: string;
sid: string;
trunk_sid: string;
friendly_name: string;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class IpAccessControlListInstance {
protected _version: V1;
protected _solution: IpAccessControlListContextSolution;
protected _context?: IpAccessControlListContext;
constructor(_version: V1, payload: IpAccessControlListResource, trunkSid: string, sid?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlList resource.
*/
accountSid: string;
/**
* The unique string that we created to identify the IpAccessControlList resource.
*/
sid: string;
/**
* The SID of the Trunk the resource is associated with.
*/
trunkSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Remove a IpAccessControlListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a IpAccessControlListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a IpAccessControlListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpAccessControlListInstance
*/
fetch(callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>;
/**
* Fetch a IpAccessControlListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpAccessControlListInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<IpAccessControlListInstance>) => any): Promise<ApiResponse<IpAccessControlListInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
sid: string;
trunkSid: string;
friendlyName: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface IpAccessControlListSolution {
trunkSid: string;
}
export interface IpAccessControlListListInstance {
_version: V1;
_solution: IpAccessControlListSolution;
_uri: string;
(sid: string): IpAccessControlListContext;
get(sid: string): IpAccessControlListContext;
/**
* Create a IpAccessControlListInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpAccessControlListInstance
*/
create(params: IpAccessControlListListInstanceCreateOptions, callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>;
/**
* Create a IpAccessControlListInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpAccessControlListInstance with HTTP metadata
*/
createWithHttpInfo(params: IpAccessControlListListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<IpAccessControlListInstance>) => any): Promise<ApiResponse<IpAccessControlListInstance>>;
/**
* Streams IpAccessControlListInstance 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 { IpAccessControlListListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: IpAccessControlListInstance, done: (err?: Error) => void) => void): void;
each(params: IpAccessControlListListInstanceEachOptions, callback?: (item: IpAccessControlListInstance, done: (err?: Error) => void) => void): void;
/**
* Streams IpAccessControlListInstance 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 { IpAccessControlListListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: IpAccessControlListInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: IpAccessControlListListInstanceEachOptions, callback?: (item: IpAccessControlListInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of IpAccessControlListInstance 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: IpAccessControlListPage) => any): Promise<IpAccessControlListPage>;
/**
* Retrieve a single target page of IpAccessControlListInstance 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<IpAccessControlListPage>) => any): Promise<ApiResponse<IpAccessControlListPage>>;
/**
* Lists IpAccessControlListInstance 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 { IpAccessControlListListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: IpAccessControlListInstance[]) => any): Promise<IpAccessControlListInstance[]>;
list(params: IpAccessControlListListInstanceOptions, callback?: (error: Error | null, items: IpAccessControlListInstance[]) => any): Promise<IpAccessControlListInstance[]>;
/**
* Lists IpAccessControlListInstance 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 { IpAccessControlListListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<IpAccessControlListInstance[]>) => any): Promise<ApiResponse<IpAccessControlListInstance[]>>;
listWithHttpInfo(params: IpAccessControlListListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<IpAccessControlListInstance[]>) => any): Promise<ApiResponse<IpAccessControlListInstance[]>>;
/**
* Retrieve a single page of IpAccessControlListInstance 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 { IpAccessControlListListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: IpAccessControlListPage) => any): Promise<IpAccessControlListPage>;
page(params: IpAccessControlListListInstancePageOptions, callback?: (error: Error | null, items: IpAccessControlListPage) => any): Promise<IpAccessControlListPage>;
/**
* Retrieve a single page of IpAccessControlListInstance 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 { IpAccessControlListListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<IpAccessControlListPage>) => any): Promise<ApiResponse<IpAccessControlListPage>>;
pageWithHttpInfo(params: IpAccessControlListListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<IpAccessControlListPage>) => any): Promise<ApiResponse<IpAccessControlListPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function IpAccessControlListListInstance(version: V1, trunkSid: string): IpAccessControlListListInstance;
export declare class IpAccessControlListPage extends Page<V1, IpAccessControlListPayload, IpAccessControlListResource, IpAccessControlListInstance> {
/**
* Initialize the IpAccessControlListPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: IpAccessControlListSolution);
/**
* Build an instance of IpAccessControlListInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: IpAccessControlListResource): IpAccessControlListInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,367 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trunking
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IpAccessControlListPage = exports.IpAccessControlListInstance = exports.IpAccessControlListContextImpl = void 0;
exports.IpAccessControlListListInstance = IpAccessControlListListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class IpAccessControlListContextImpl {
constructor(_version, trunkSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { trunkSid, sid };
this._uri = `/Trunks/${trunkSid}/IpAccessControlLists/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new IpAccessControlListInstance(operationVersion, payload, instance._solution.trunkSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new IpAccessControlListInstance(operationVersion, response.body, instance._solution.trunkSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.IpAccessControlListContextImpl = IpAccessControlListContextImpl;
class IpAccessControlListInstance {
constructor(_version, payload, trunkSid, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.sid = payload.sid;
this.trunkSid = payload.trunk_sid;
this.friendlyName = payload.friendly_name;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { trunkSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new IpAccessControlListContextImpl(this._version, this._solution.trunkSid, this._solution.sid);
return this._context;
}
/**
* Remove a IpAccessControlListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a IpAccessControlListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a IpAccessControlListInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpAccessControlListInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a IpAccessControlListInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpAccessControlListInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
sid: this.sid,
trunkSid: this.trunkSid,
friendlyName: this.friendlyName,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.IpAccessControlListInstance = IpAccessControlListInstance;
function IpAccessControlListListInstance(version, trunkSid) {
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new IpAccessControlListContextImpl(version, trunkSid, sid);
};
instance._version = version;
instance._solution = { trunkSid };
instance._uri = `/Trunks/${trunkSid}/IpAccessControlLists`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["ipAccessControlListSid"] === null ||
params["ipAccessControlListSid"] === undefined) {
throw new Error("Required parameter \"params['ipAccessControlListSid']\" missing.");
}
let data = {};
data["IpAccessControlListSid"] = params["ipAccessControlListSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new IpAccessControlListInstance(operationVersion, payload, instance._solution.trunkSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["ipAccessControlListSid"] === null ||
params["ipAccessControlListSid"] === undefined) {
throw new Error("Required parameter \"params['ipAccessControlListSid']\" missing.");
}
let data = {};
data["IpAccessControlListSid"] = params["ipAccessControlListSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new IpAccessControlListInstance(operationVersion, response.body, instance._solution.trunkSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new IpAccessControlListPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new IpAccessControlListPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new IpAccessControlListPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new IpAccessControlListPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class IpAccessControlListPage extends Page_1.default {
/**
* Initialize the IpAccessControlListPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of IpAccessControlListInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new IpAccessControlListInstance(this._version, payload, this._solution.trunkSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.IpAccessControlListPage = IpAccessControlListPage;

View File

@@ -0,0 +1,470 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to update a OriginationUrlInstance
*/
export interface OriginationUrlContextUpdateOptions {
/** The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. */
weight?: number;
/** The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. */
priority?: number;
/** Whether the URL is enabled. The default is `true`. */
enabled?: boolean;
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName?: string;
/** The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. `sips` is NOT supported. */
sipUrl?: string;
}
/**
* Options to pass to create a OriginationUrlInstance
*/
export interface OriginationUrlListInstanceCreateOptions {
/** The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. */
weight: number;
/** The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. */
priority: number;
/** Whether the URL is enabled. The default is `true`. */
enabled: boolean;
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName: string;
/** The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. */
sipUrl: string;
}
/**
* Options to pass to each
*/
export interface OriginationUrlListInstanceEachOptions {
/** 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: OriginationUrlInstance, 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 OriginationUrlListInstanceOptions {
/** 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 OriginationUrlListInstancePageOptions {
/** 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 OriginationUrlContext {
/**
* Remove a OriginationUrlInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a OriginationUrlInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a OriginationUrlInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance
*/
fetch(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>;
/**
* Fetch a OriginationUrlInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any): Promise<ApiResponse<OriginationUrlInstance>>;
/**
* Update a OriginationUrlInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance
*/
update(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>;
/**
* Update a OriginationUrlInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance
*/
update(params: OriginationUrlContextUpdateOptions, callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>;
/**
* Update a OriginationUrlInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any): Promise<ApiResponse<OriginationUrlInstance>>;
/**
* Update a OriginationUrlInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance with HTTP metadata
*/
updateWithHttpInfo(params: OriginationUrlContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any): Promise<ApiResponse<OriginationUrlInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface OriginationUrlContextSolution {
trunkSid: string;
sid: string;
}
export declare class OriginationUrlContextImpl implements OriginationUrlContext {
protected _version: V1;
protected _solution: OriginationUrlContextSolution;
protected _uri: string;
constructor(_version: V1, trunkSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any): Promise<ApiResponse<OriginationUrlInstance>>;
update(params?: OriginationUrlContextUpdateOptions | ((error: Error | null, item?: OriginationUrlInstance) => any), callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>;
updateWithHttpInfo(params?: OriginationUrlContextUpdateOptions | ((error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any): Promise<ApiResponse<OriginationUrlInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): OriginationUrlContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface OriginationUrlPayload extends TwilioResponsePayload {
origination_urls: OriginationUrlResource[];
}
interface OriginationUrlResource {
account_sid: string;
sid: string;
trunk_sid: string;
weight: number;
enabled: boolean;
sip_url: string;
friendly_name: string;
priority: number;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class OriginationUrlInstance {
protected _version: V1;
protected _solution: OriginationUrlContextSolution;
protected _context?: OriginationUrlContext;
constructor(_version: V1, payload: OriginationUrlResource, trunkSid: string, sid?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OriginationUrl resource.
*/
accountSid: string;
/**
* The unique string that we created to identify the OriginationUrl resource.
*/
sid: string;
/**
* The SID of the Trunk that owns the Origination URL.
*/
trunkSid: string;
/**
* The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority.
*/
weight: number;
/**
* Whether the URL is enabled. The default is `true`.
*/
enabled: boolean;
/**
* The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema.
*/
sipUrl: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI.
*/
priority: number;
/**
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Remove a OriginationUrlInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a OriginationUrlInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a OriginationUrlInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance
*/
fetch(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>;
/**
* Fetch a OriginationUrlInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any): Promise<ApiResponse<OriginationUrlInstance>>;
/**
* Update a OriginationUrlInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance
*/
update(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>;
/**
* Update a OriginationUrlInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance
*/
update(params: OriginationUrlContextUpdateOptions, callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>;
/**
* Update a OriginationUrlInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any): Promise<ApiResponse<OriginationUrlInstance>>;
/**
* Update a OriginationUrlInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance with HTTP metadata
*/
updateWithHttpInfo(params: OriginationUrlContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any): Promise<ApiResponse<OriginationUrlInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
sid: string;
trunkSid: string;
weight: number;
enabled: boolean;
sipUrl: string;
friendlyName: string;
priority: number;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface OriginationUrlSolution {
trunkSid: string;
}
export interface OriginationUrlListInstance {
_version: V1;
_solution: OriginationUrlSolution;
_uri: string;
(sid: string): OriginationUrlContext;
get(sid: string): OriginationUrlContext;
/**
* Create a OriginationUrlInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance
*/
create(params: OriginationUrlListInstanceCreateOptions, callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>;
/**
* Create a OriginationUrlInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance with HTTP metadata
*/
createWithHttpInfo(params: OriginationUrlListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<OriginationUrlInstance>) => any): Promise<ApiResponse<OriginationUrlInstance>>;
/**
* Streams OriginationUrlInstance 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 { OriginationUrlListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: OriginationUrlInstance, done: (err?: Error) => void) => void): void;
each(params: OriginationUrlListInstanceEachOptions, callback?: (item: OriginationUrlInstance, done: (err?: Error) => void) => void): void;
/**
* Streams OriginationUrlInstance 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 { OriginationUrlListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: OriginationUrlInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: OriginationUrlListInstanceEachOptions, callback?: (item: OriginationUrlInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of OriginationUrlInstance 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: OriginationUrlPage) => any): Promise<OriginationUrlPage>;
/**
* Retrieve a single target page of OriginationUrlInstance 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<OriginationUrlPage>) => any): Promise<ApiResponse<OriginationUrlPage>>;
/**
* Lists OriginationUrlInstance 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 { OriginationUrlListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: OriginationUrlInstance[]) => any): Promise<OriginationUrlInstance[]>;
list(params: OriginationUrlListInstanceOptions, callback?: (error: Error | null, items: OriginationUrlInstance[]) => any): Promise<OriginationUrlInstance[]>;
/**
* Lists OriginationUrlInstance 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 { OriginationUrlListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OriginationUrlInstance[]>) => any): Promise<ApiResponse<OriginationUrlInstance[]>>;
listWithHttpInfo(params: OriginationUrlListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<OriginationUrlInstance[]>) => any): Promise<ApiResponse<OriginationUrlInstance[]>>;
/**
* Retrieve a single page of OriginationUrlInstance 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 { OriginationUrlListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: OriginationUrlPage) => any): Promise<OriginationUrlPage>;
page(params: OriginationUrlListInstancePageOptions, callback?: (error: Error | null, items: OriginationUrlPage) => any): Promise<OriginationUrlPage>;
/**
* Retrieve a single page of OriginationUrlInstance 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 { OriginationUrlListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OriginationUrlPage>) => any): Promise<ApiResponse<OriginationUrlPage>>;
pageWithHttpInfo(params: OriginationUrlListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<OriginationUrlPage>) => any): Promise<ApiResponse<OriginationUrlPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function OriginationUrlListInstance(version: V1, trunkSid: string): OriginationUrlListInstance;
export declare class OriginationUrlPage extends Page<V1, OriginationUrlPayload, OriginationUrlResource, OriginationUrlInstance> {
/**
* Initialize the OriginationUrlPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: OriginationUrlSolution);
/**
* Build an instance of OriginationUrlInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: OriginationUrlResource): OriginationUrlInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,485 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trunking
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OriginationUrlPage = exports.OriginationUrlInstance = exports.OriginationUrlContextImpl = void 0;
exports.OriginationUrlListInstance = OriginationUrlListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class OriginationUrlContextImpl {
constructor(_version, trunkSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { trunkSid, sid };
this._uri = `/Trunks/${trunkSid}/OriginationUrls/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new OriginationUrlInstance(operationVersion, payload, instance._solution.trunkSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new OriginationUrlInstance(operationVersion, response.body, instance._solution.trunkSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["weight"] !== undefined)
data["Weight"] = params["weight"];
if (params["priority"] !== undefined)
data["Priority"] = params["priority"];
if (params["enabled"] !== undefined)
data["Enabled"] = serialize.bool(params["enabled"]);
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["sipUrl"] !== undefined)
data["SipUrl"] = params["sipUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new OriginationUrlInstance(operationVersion, payload, instance._solution.trunkSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["weight"] !== undefined)
data["Weight"] = params["weight"];
if (params["priority"] !== undefined)
data["Priority"] = params["priority"];
if (params["enabled"] !== undefined)
data["Enabled"] = serialize.bool(params["enabled"]);
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["sipUrl"] !== undefined)
data["SipUrl"] = params["sipUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new OriginationUrlInstance(operationVersion, response.body, instance._solution.trunkSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OriginationUrlContextImpl = OriginationUrlContextImpl;
class OriginationUrlInstance {
constructor(_version, payload, trunkSid, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.sid = payload.sid;
this.trunkSid = payload.trunk_sid;
this.weight = deserialize.integer(payload.weight);
this.enabled = payload.enabled;
this.sipUrl = payload.sip_url;
this.friendlyName = payload.friendly_name;
this.priority = deserialize.integer(payload.priority);
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { trunkSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new OriginationUrlContextImpl(this._version, this._solution.trunkSid, this._solution.sid);
return this._context;
}
/**
* Remove a OriginationUrlInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a OriginationUrlInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a OriginationUrlInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a OriginationUrlInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OriginationUrlInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
sid: this.sid,
trunkSid: this.trunkSid,
weight: this.weight,
enabled: this.enabled,
sipUrl: this.sipUrl,
friendlyName: this.friendlyName,
priority: this.priority,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OriginationUrlInstance = OriginationUrlInstance;
function OriginationUrlListInstance(version, trunkSid) {
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new OriginationUrlContextImpl(version, trunkSid, sid);
};
instance._version = version;
instance._solution = { trunkSid };
instance._uri = `/Trunks/${trunkSid}/OriginationUrls`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["weight"] === null || params["weight"] === undefined) {
throw new Error("Required parameter \"params['weight']\" missing.");
}
if (params["priority"] === null || params["priority"] === undefined) {
throw new Error("Required parameter \"params['priority']\" missing.");
}
if (params["enabled"] === null || params["enabled"] === undefined) {
throw new Error("Required parameter \"params['enabled']\" missing.");
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["sipUrl"] === null || params["sipUrl"] === undefined) {
throw new Error("Required parameter \"params['sipUrl']\" missing.");
}
let data = {};
data["Weight"] = params["weight"];
data["Priority"] = params["priority"];
data["Enabled"] = serialize.bool(params["enabled"]);
data["FriendlyName"] = params["friendlyName"];
data["SipUrl"] = params["sipUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new OriginationUrlInstance(operationVersion, payload, instance._solution.trunkSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["weight"] === null || params["weight"] === undefined) {
throw new Error("Required parameter \"params['weight']\" missing.");
}
if (params["priority"] === null || params["priority"] === undefined) {
throw new Error("Required parameter \"params['priority']\" missing.");
}
if (params["enabled"] === null || params["enabled"] === undefined) {
throw new Error("Required parameter \"params['enabled']\" missing.");
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["sipUrl"] === null || params["sipUrl"] === undefined) {
throw new Error("Required parameter \"params['sipUrl']\" missing.");
}
let data = {};
data["Weight"] = params["weight"];
data["Priority"] = params["priority"];
data["Enabled"] = serialize.bool(params["enabled"]);
data["FriendlyName"] = params["friendlyName"];
data["SipUrl"] = params["sipUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new OriginationUrlInstance(operationVersion, response.body, instance._solution.trunkSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new OriginationUrlPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new OriginationUrlPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new OriginationUrlPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new OriginationUrlPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class OriginationUrlPage extends Page_1.default {
/**
* Initialize the OriginationUrlPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of OriginationUrlInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new OriginationUrlInstance(this._version, payload, this._solution.trunkSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OriginationUrlPage = OriginationUrlPage;

View File

@@ -0,0 +1,466 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
import { PhoneNumberCapabilities } from "../../../../interfaces";
/**
* Whether the phone number requires an [Address](https://www.twilio.com/docs/usage/api/address) registered with Twilio and, if so, what type. Can be: `none`, `any`, `local`, or `foreign`.
*/
export type PhoneNumberAddressRequirement = "none" | "any" | "local" | "foreign";
/**
* Options to pass to create a PhoneNumberInstance
*/
export interface PhoneNumberListInstanceCreateOptions {
/** The SID of the [Incoming Phone Number](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) that you want to associate with the trunk. */
phoneNumberSid: string;
}
/**
* Options to pass to each
*/
export interface PhoneNumberListInstanceEachOptions {
/** 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: PhoneNumberInstance, 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 PhoneNumberListInstanceOptions {
/** 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 PhoneNumberListInstancePageOptions {
/** 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 PhoneNumberContext {
/**
* Remove a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface PhoneNumberContextSolution {
trunkSid: string;
sid: string;
}
export declare class PhoneNumberContextImpl implements PhoneNumberContext {
protected _version: V1;
protected _solution: PhoneNumberContextSolution;
protected _uri: string;
constructor(_version: V1, trunkSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): PhoneNumberContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface PhoneNumberPayload extends TwilioResponsePayload {
phone_numbers: PhoneNumberResource[];
}
interface PhoneNumberResource {
account_sid: string;
address_requirements: PhoneNumberAddressRequirement;
api_version: string;
beta: boolean;
capabilities: PhoneNumberCapabilities;
date_created: Date;
date_updated: Date;
friendly_name: string;
links: Record<string, string>;
phone_number: string;
sid: string;
sms_application_sid: string;
sms_fallback_method: string;
sms_fallback_url: string;
sms_method: string;
sms_url: string;
status_callback: string;
status_callback_method: string;
trunk_sid: string;
url: string;
voice_application_sid: string;
voice_caller_id_lookup: boolean;
voice_fallback_method: string;
voice_fallback_url: string;
voice_method: string;
voice_url: string;
}
export declare class PhoneNumberInstance {
protected _version: V1;
protected _solution: PhoneNumberContextSolution;
protected _context?: PhoneNumberContext;
constructor(_version: V1, payload: PhoneNumberResource, trunkSid: string, sid?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource.
*/
accountSid: string;
addressRequirements: PhoneNumberAddressRequirement;
/**
* The API version used to start a new TwiML session.
*/
apiVersion: string;
/**
* Whether the phone number is new to the Twilio platform. Can be: `true` or `false`.
*/
beta: boolean;
capabilities: PhoneNumberCapabilities;
/**
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The URLs of related resources.
*/
links: Record<string, string>;
/**
* The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.
*/
phoneNumber: string;
/**
* The unique string that we created to identify the PhoneNumber resource.
*/
sid: string;
/**
* The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application.
*/
smsApplicationSid: string;
/**
* The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`.
*/
smsFallbackMethod: string;
/**
* The URL that we call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML from `sms_url`.
*/
smsFallbackUrl: string;
/**
* The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`.
*/
smsMethod: string;
/**
* The URL we call using the `sms_method` when the phone number receives an incoming SMS message.
*/
smsUrl: string;
/**
* The URL we call using the `status_callback_method` to send status information to your application.
*/
statusCallback: string;
/**
* The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`.
*/
statusCallbackMethod: string;
/**
* The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice URLs and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa.
*/
trunkSid: string;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice URLs and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa.
*/
voiceApplicationSid: string;
/**
* Whether we look up the caller\'s caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`.
*/
voiceCallerIdLookup: boolean;
/**
* The HTTP method that we use to call `voice_fallback_url`. Can be: `GET` or `POST`.
*/
voiceFallbackMethod: string;
/**
* The URL that we call using the `voice_fallback_method` when an error occurs retrieving or executing the TwiML requested by `url`.
*/
voiceFallbackUrl: string;
/**
* The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`.
*/
voiceMethod: string;
/**
* The URL we call using the `voice_method` when the phone number receives a call. The `voice_url` is not be used if a `voice_application_sid` or a `trunk_sid` is set.
*/
voiceUrl: string;
private get _proxy();
/**
* Remove a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
addressRequirements: PhoneNumberAddressRequirement;
apiVersion: string;
beta: boolean;
capabilities: PhoneNumberCapabilities;
dateCreated: Date;
dateUpdated: Date;
friendlyName: string;
links: Record<string, string>;
phoneNumber: string;
sid: string;
smsApplicationSid: string;
smsFallbackMethod: string;
smsFallbackUrl: string;
smsMethod: string;
smsUrl: string;
statusCallback: string;
statusCallbackMethod: string;
trunkSid: string;
url: string;
voiceApplicationSid: string;
voiceCallerIdLookup: boolean;
voiceFallbackMethod: string;
voiceFallbackUrl: string;
voiceMethod: string;
voiceUrl: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface PhoneNumberSolution {
trunkSid: string;
}
export interface PhoneNumberListInstance {
_version: V1;
_solution: PhoneNumberSolution;
_uri: string;
(sid: string): PhoneNumberContext;
get(sid: string): PhoneNumberContext;
/**
* Create a PhoneNumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
create(params: PhoneNumberListInstanceCreateOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Create a PhoneNumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
createWithHttpInfo(params: PhoneNumberListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Streams PhoneNumberInstance 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 { PhoneNumberListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void;
each(params: PhoneNumberListInstanceEachOptions, callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void;
/**
* Streams PhoneNumberInstance 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 { PhoneNumberListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: PhoneNumberListInstanceEachOptions, callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of PhoneNumberInstance 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: PhoneNumberPage) => any): Promise<PhoneNumberPage>;
/**
* Retrieve a single target page of PhoneNumberInstance 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<PhoneNumberPage>) => any): Promise<ApiResponse<PhoneNumberPage>>;
/**
* Lists PhoneNumberInstance 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 { PhoneNumberListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>;
list(params: PhoneNumberListInstanceOptions, callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>;
/**
* Lists PhoneNumberInstance 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 { PhoneNumberListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PhoneNumberInstance[]>) => any): Promise<ApiResponse<PhoneNumberInstance[]>>;
listWithHttpInfo(params: PhoneNumberListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<PhoneNumberInstance[]>) => any): Promise<ApiResponse<PhoneNumberInstance[]>>;
/**
* Retrieve a single page of PhoneNumberInstance 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 { PhoneNumberListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>;
page(params: PhoneNumberListInstancePageOptions, callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>;
/**
* Retrieve a single page of PhoneNumberInstance 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 { PhoneNumberListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PhoneNumberPage>) => any): Promise<ApiResponse<PhoneNumberPage>>;
pageWithHttpInfo(params: PhoneNumberListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<PhoneNumberPage>) => any): Promise<ApiResponse<PhoneNumberPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function PhoneNumberListInstance(version: V1, trunkSid: string): PhoneNumberListInstance;
export declare class PhoneNumberPage extends Page<V1, PhoneNumberPayload, PhoneNumberResource, PhoneNumberInstance> {
/**
* Initialize the PhoneNumberPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: PhoneNumberSolution);
/**
* Build an instance of PhoneNumberInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: PhoneNumberResource): PhoneNumberInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,405 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trunking
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PhoneNumberPage = exports.PhoneNumberInstance = exports.PhoneNumberContextImpl = void 0;
exports.PhoneNumberListInstance = PhoneNumberListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class PhoneNumberContextImpl {
constructor(_version, trunkSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { trunkSid, sid };
this._uri = `/Trunks/${trunkSid}/PhoneNumbers/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.trunkSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new PhoneNumberInstance(operationVersion, response.body, instance._solution.trunkSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberContextImpl = PhoneNumberContextImpl;
class PhoneNumberInstance {
constructor(_version, payload, trunkSid, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.addressRequirements = payload.address_requirements;
this.apiVersion = payload.api_version;
this.beta = payload.beta;
this.capabilities = payload.capabilities;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.friendlyName = payload.friendly_name;
this.links = payload.links;
this.phoneNumber = payload.phone_number;
this.sid = payload.sid;
this.smsApplicationSid = payload.sms_application_sid;
this.smsFallbackMethod = payload.sms_fallback_method;
this.smsFallbackUrl = payload.sms_fallback_url;
this.smsMethod = payload.sms_method;
this.smsUrl = payload.sms_url;
this.statusCallback = payload.status_callback;
this.statusCallbackMethod = payload.status_callback_method;
this.trunkSid = payload.trunk_sid;
this.url = payload.url;
this.voiceApplicationSid = payload.voice_application_sid;
this.voiceCallerIdLookup = payload.voice_caller_id_lookup;
this.voiceFallbackMethod = payload.voice_fallback_method;
this.voiceFallbackUrl = payload.voice_fallback_url;
this.voiceMethod = payload.voice_method;
this.voiceUrl = payload.voice_url;
this._solution = { trunkSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new PhoneNumberContextImpl(this._version, this._solution.trunkSid, this._solution.sid);
return this._context;
}
/**
* Remove a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
addressRequirements: this.addressRequirements,
apiVersion: this.apiVersion,
beta: this.beta,
capabilities: this.capabilities,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
friendlyName: this.friendlyName,
links: this.links,
phoneNumber: this.phoneNumber,
sid: this.sid,
smsApplicationSid: this.smsApplicationSid,
smsFallbackMethod: this.smsFallbackMethod,
smsFallbackUrl: this.smsFallbackUrl,
smsMethod: this.smsMethod,
smsUrl: this.smsUrl,
statusCallback: this.statusCallback,
statusCallbackMethod: this.statusCallbackMethod,
trunkSid: this.trunkSid,
url: this.url,
voiceApplicationSid: this.voiceApplicationSid,
voiceCallerIdLookup: this.voiceCallerIdLookup,
voiceFallbackMethod: this.voiceFallbackMethod,
voiceFallbackUrl: this.voiceFallbackUrl,
voiceMethod: this.voiceMethod,
voiceUrl: this.voiceUrl,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberInstance = PhoneNumberInstance;
function PhoneNumberListInstance(version, trunkSid) {
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new PhoneNumberContextImpl(version, trunkSid, sid);
};
instance._version = version;
instance._solution = { trunkSid };
instance._uri = `/Trunks/${trunkSid}/PhoneNumbers`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["phoneNumberSid"] === null ||
params["phoneNumberSid"] === undefined) {
throw new Error("Required parameter \"params['phoneNumberSid']\" missing.");
}
let data = {};
data["PhoneNumberSid"] = params["phoneNumberSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.trunkSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["phoneNumberSid"] === null ||
params["phoneNumberSid"] === undefined) {
throw new Error("Required parameter \"params['phoneNumberSid']\" missing.");
}
let data = {};
data["PhoneNumberSid"] = params["phoneNumberSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new PhoneNumberInstance(operationVersion, response.body, instance._solution.trunkSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new PhoneNumberPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new PhoneNumberPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new PhoneNumberPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new PhoneNumberPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class PhoneNumberPage extends Page_1.default {
/**
* Initialize the PhoneNumberPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of PhoneNumberInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new PhoneNumberInstance(this._version, payload, this._solution.trunkSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberPage = PhoneNumberPage;

View File

@@ -0,0 +1,187 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* The recording mode for the trunk. Can be do-not-record (default), record-from-ringing, record-from-answer, record-from-ringing-dual, or record-from-answer-dual.
*/
export type RecordingRecordingMode = "do-not-record" | "record-from-ringing" | "record-from-answer" | "record-from-ringing-dual" | "record-from-answer-dual";
/**
* The recording trim setting for the trunk. Can be do-not-trim (default) or trim-silence.
*/
export type RecordingRecordingTrim = "trim-silence" | "do-not-trim";
/**
* Options to pass to update a RecordingInstance
*/
export interface RecordingContextUpdateOptions {
/** */
mode?: RecordingRecordingMode;
/** */
trim?: RecordingRecordingTrim;
}
export interface RecordingContext {
/**
* Fetch a RecordingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance
*/
fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>;
/**
* Fetch a RecordingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RecordingInstance>) => any): Promise<ApiResponse<RecordingInstance>>;
/**
* Update a RecordingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance
*/
update(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>;
/**
* Update a RecordingInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance
*/
update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>;
/**
* Update a RecordingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RecordingInstance>) => any): Promise<ApiResponse<RecordingInstance>>;
/**
* Update a RecordingInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance with HTTP metadata
*/
updateWithHttpInfo(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<RecordingInstance>) => any): Promise<ApiResponse<RecordingInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface RecordingContextSolution {
trunkSid: string;
}
export declare class RecordingContextImpl implements RecordingContext {
protected _version: V1;
protected _solution: RecordingContextSolution;
protected _uri: string;
constructor(_version: V1, trunkSid: string);
fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RecordingInstance>) => any): Promise<ApiResponse<RecordingInstance>>;
update(params?: RecordingContextUpdateOptions | ((error: Error | null, item?: RecordingInstance) => any), callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>;
updateWithHttpInfo(params?: RecordingContextUpdateOptions | ((error: Error | null, item?: ApiResponse<RecordingInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<RecordingInstance>) => any): Promise<ApiResponse<RecordingInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): RecordingContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface RecordingResource {
mode: RecordingRecordingMode;
trim: RecordingRecordingTrim;
}
export declare class RecordingInstance {
protected _version: V1;
protected _solution: RecordingContextSolution;
protected _context?: RecordingContext;
constructor(_version: V1, payload: RecordingResource, trunkSid: string);
mode: RecordingRecordingMode;
trim: RecordingRecordingTrim;
private get _proxy();
/**
* Fetch a RecordingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance
*/
fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>;
/**
* Fetch a RecordingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RecordingInstance>) => any): Promise<ApiResponse<RecordingInstance>>;
/**
* Update a RecordingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance
*/
update(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>;
/**
* Update a RecordingInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance
*/
update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>;
/**
* Update a RecordingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RecordingInstance>) => any): Promise<ApiResponse<RecordingInstance>>;
/**
* Update a RecordingInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance with HTTP metadata
*/
updateWithHttpInfo(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<RecordingInstance>) => any): Promise<ApiResponse<RecordingInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
mode: RecordingRecordingMode;
trim: RecordingRecordingTrim;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface RecordingSolution {
trunkSid: string;
}
export interface RecordingListInstance {
_version: V1;
_solution: RecordingSolution;
_uri: string;
(): RecordingContext;
get(): RecordingContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function RecordingListInstance(version: V1, trunkSid: string): RecordingListInstance;
export {};

View File

@@ -0,0 +1,209 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Trunking
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.RecordingInstance = exports.RecordingContextImpl = void 0;
exports.RecordingListInstance = RecordingListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class RecordingContextImpl {
constructor(_version, trunkSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
this._solution = { trunkSid };
this._uri = `/Trunks/${trunkSid}/Recording`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.trunkSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new RecordingInstance(operationVersion, response.body, instance._solution.trunkSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["mode"] !== undefined)
data["Mode"] = params["mode"];
if (params["trim"] !== undefined)
data["Trim"] = params["trim"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.trunkSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["mode"] !== undefined)
data["Mode"] = params["mode"];
if (params["trim"] !== undefined)
data["Trim"] = params["trim"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new RecordingInstance(operationVersion, response.body, instance._solution.trunkSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RecordingContextImpl = RecordingContextImpl;
class RecordingInstance {
constructor(_version, payload, trunkSid) {
this._version = _version;
this.mode = payload.mode;
this.trim = payload.trim;
this._solution = { trunkSid };
}
get _proxy() {
this._context =
this._context ||
new RecordingContextImpl(this._version, this._solution.trunkSid);
return this._context;
}
/**
* Fetch a RecordingInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a RecordingInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RecordingInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
mode: this.mode,
trim: this.trim,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RecordingInstance = RecordingInstance;
function RecordingListInstance(version, trunkSid) {
if (!(0, utility_1.isValidPathParam)(trunkSid)) {
throw new Error("Parameter 'trunkSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new RecordingContextImpl(version, trunkSid);
};
instance._version = version;
instance._solution = { trunkSid };
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}