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

25
node_modules/twilio/lib/rest/pricing/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import PricingBase from "../PricingBase";
import Version from "../../base/Version";
import { MessagingListInstance } from "./v1/messaging";
import { PhoneNumberListInstance } from "./v1/phoneNumber";
import { VoiceListInstance } from "./v1/voice";
export default class V1 extends Version {
/**
* Initialize the V1 version of Pricing
*
* @param domain - The Twilio (Twilio.Pricing) domain
*/
constructor(domain: PricingBase);
/** messaging - { Twilio.Pricing.V1.MessagingListInstance } resource */
protected _messaging?: MessagingListInstance;
/** phoneNumbers - { Twilio.Pricing.V1.PhoneNumberListInstance } resource */
protected _phoneNumbers?: PhoneNumberListInstance;
/** voice - { Twilio.Pricing.V1.VoiceListInstance } resource */
protected _voice?: VoiceListInstance;
/** Getter for messaging resource */
get messaging(): MessagingListInstance;
/** Getter for phoneNumbers resource */
get phoneNumbers(): PhoneNumberListInstance;
/** Getter for voice resource */
get voice(): VoiceListInstance;
}

48
node_modules/twilio/lib/rest/pricing/V1.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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 messaging_1 = require("./v1/messaging");
const phoneNumber_1 = require("./v1/phoneNumber");
const voice_1 = require("./v1/voice");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Pricing
*
* @param domain - The Twilio (Twilio.Pricing) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for messaging resource */
get messaging() {
this._messaging = this._messaging || (0, messaging_1.MessagingListInstance)(this);
return this._messaging;
}
/** Getter for phoneNumbers resource */
get phoneNumbers() {
this._phoneNumbers = this._phoneNumbers || (0, phoneNumber_1.PhoneNumberListInstance)(this);
return this._phoneNumbers;
}
/** Getter for voice resource */
get voice() {
this._voice = this._voice || (0, voice_1.VoiceListInstance)(this);
return this._voice;
}
}
exports.default = V1;

25
node_modules/twilio/lib/rest/pricing/V2.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import PricingBase from "../PricingBase";
import Version from "../../base/Version";
import { CountryListInstance } from "./v2/country";
import { NumberListInstance } from "./v2/number";
import { VoiceListInstance } from "./v2/voice";
export default class V2 extends Version {
/**
* Initialize the V2 version of Pricing
*
* @param domain - The Twilio (Twilio.Pricing) domain
*/
constructor(domain: PricingBase);
/** countries - { Twilio.Pricing.V2.CountryListInstance } resource */
protected _countries?: CountryListInstance;
/** numbers - { Twilio.Pricing.V2.NumberListInstance } resource */
protected _numbers?: NumberListInstance;
/** voice - { Twilio.Pricing.V2.VoiceListInstance } resource */
protected _voice?: VoiceListInstance;
/** Getter for countries resource */
get countries(): CountryListInstance;
/** Getter for numbers resource */
get numbers(): NumberListInstance;
/** Getter for voice resource */
get voice(): VoiceListInstance;
}

48
node_modules/twilio/lib/rest/pricing/V2.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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 country_1 = require("./v2/country");
const number_1 = require("./v2/number");
const voice_1 = require("./v2/voice");
class V2 extends Version_1.default {
/**
* Initialize the V2 version of Pricing
*
* @param domain - The Twilio (Twilio.Pricing) domain
*/
constructor(domain) {
super(domain, "v2");
}
/** Getter for countries resource */
get countries() {
this._countries = this._countries || (0, country_1.CountryListInstance)(this);
return this._countries;
}
/** Getter for numbers resource */
get numbers() {
this._numbers = this._numbers || (0, number_1.NumberListInstance)(this);
return this._numbers;
}
/** Getter for voice resource */
get voice() {
this._voice = this._voice || (0, voice_1.VoiceListInstance)(this);
return this._voice;
}
}
exports.default = V2;

18
node_modules/twilio/lib/rest/pricing/v1/messaging.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { CountryListInstance } from "./messaging/country";
export interface MessagingSolution {
}
export interface MessagingListInstance {
_version: V1;
_solution: MessagingSolution;
_uri: string;
_countries?: CountryListInstance;
countries: CountryListInstance;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function MessagingListInstance(version: V1): MessagingListInstance;

41
node_modules/twilio/lib/rest/pricing/v1/messaging.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.MessagingListInstance = MessagingListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const country_1 = require("./messaging/country");
function MessagingListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Messaging`;
Object.defineProperty(instance, "countries", {
get: function countries() {
if (!instance._countries) {
instance._countries = (0, country_1.CountryListInstance)(instance._version);
}
return instance._countries;
},
});
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;
}

View File

@@ -0,0 +1,305 @@
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";
export declare class PricingV1MessagingMessagingCountryInstanceInboundSmsPrices {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
constructor(payload: any);
}
export declare class PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices {
"carrier"?: string;
"mcc"?: string;
"mnc"?: string;
"prices"?: Array<PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices>;
constructor(payload: any);
}
export declare class PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
constructor(payload: any);
}
/**
* Options to pass to each
*/
export interface CountryListInstanceEachOptions {
/** 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: CountryInstance, 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 CountryListInstanceOptions {
/** 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 CountryListInstancePageOptions {
/** 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 CountryContext {
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CountryContextSolution {
isoCountry: string;
}
export declare class CountryContextImpl implements CountryContext {
protected _version: V1;
protected _solution: CountryContextSolution;
protected _uri: string;
constructor(_version: V1, isoCountry: string);
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CountryContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CountryPayload extends TwilioResponsePayload {
countries: CountryResource[];
}
interface CountryResource {
country: string;
iso_country: string;
outbound_sms_prices: Array<PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices>;
inbound_sms_prices: Array<PricingV1MessagingMessagingCountryInstanceInboundSmsPrices>;
price_unit: string;
url: string;
}
export declare class CountryInstance {
protected _version: V1;
protected _solution: CountryContextSolution;
protected _context?: CountryContext;
constructor(_version: V1, payload: CountryResource, isoCountry?: string);
/**
* The name of the country.
*/
country: string;
/**
* The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
*/
isoCountry: string;
/**
* The list of [OutboundSMSPrice](https://www.twilio.com/docs/sms/api/pricing#outbound-sms-price) records that represent the price to send a message for each MCC/MNC applicable in this country.
*/
outboundSmsPrices: Array<PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices>;
/**
* The list of [InboundPrice](https://www.twilio.com/docs/sms/api/pricing#inbound-price) records that describe the price to receive an inbound SMS to the different Twilio phone number types supported in this country
*/
inboundSmsPrices: Array<PricingV1MessagingMessagingCountryInstanceInboundSmsPrices>;
/**
* The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`).
*/
priceUnit: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
country: string;
isoCountry: string;
outboundSmsPrices: PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices[];
inboundSmsPrices: PricingV1MessagingMessagingCountryInstanceInboundSmsPrices[];
priceUnit: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CountrySolution {
}
export interface CountryListInstance {
_version: V1;
_solution: CountrySolution;
_uri: string;
(isoCountry: string): CountryContext;
get(isoCountry: string): CountryContext;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single target page of CountryInstance 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<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
listWithHttpInfo(params: CountryListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
pageWithHttpInfo(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CountryListInstance(version: V1): CountryListInstance;
export declare class CountryPage extends Page<V1, CountryPayload, CountryResource, CountryInstance> {
/**
* Initialize the CountryPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CountrySolution);
/**
* Build an instance of CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CountryResource): CountryInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,295 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.CountryPage = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices = exports.PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices = exports.PricingV1MessagingMessagingCountryInstanceInboundSmsPrices = void 0;
exports.CountryListInstance = CountryListInstance;
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 PricingV1MessagingMessagingCountryInstanceInboundSmsPrices {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.numberType = payload["number_type"];
}
}
exports.PricingV1MessagingMessagingCountryInstanceInboundSmsPrices = PricingV1MessagingMessagingCountryInstanceInboundSmsPrices;
class PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices {
constructor(payload) {
this.carrier = payload["carrier"];
this.mcc = payload["mcc"];
this.mnc = payload["mnc"];
this.prices = payload["prices"];
}
}
exports.PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices = PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices;
class PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.numberType = payload["number_type"];
}
}
exports.PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices = PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices;
class CountryContextImpl {
constructor(_version, isoCountry) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(isoCountry)) {
throw new Error("Parameter 'isoCountry' is not valid.");
}
this._solution = { isoCountry };
this._uri = `/Messaging/Countries/${isoCountry}`;
}
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 CountryInstance(operationVersion, payload, instance._solution.isoCountry));
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 CountryInstance(operationVersion, response.body, instance._solution.isoCountry),
}));
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.CountryContextImpl = CountryContextImpl;
class CountryInstance {
constructor(_version, payload, isoCountry) {
this._version = _version;
this.country = payload.country;
this.isoCountry = payload.iso_country;
this.outboundSmsPrices =
payload.outbound_sms_prices !== null &&
payload.outbound_sms_prices !== undefined
? payload.outbound_sms_prices.map((payload) => new PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices(payload))
: null;
this.inboundSmsPrices =
payload.inbound_sms_prices !== null &&
payload.inbound_sms_prices !== undefined
? payload.inbound_sms_prices.map((payload) => new PricingV1MessagingMessagingCountryInstanceInboundSmsPrices(payload))
: null;
this.priceUnit = payload.price_unit;
this.url = payload.url;
this._solution = { isoCountry: isoCountry || this.isoCountry };
}
get _proxy() {
this._context =
this._context ||
new CountryContextImpl(this._version, this._solution.isoCountry);
return this._context;
}
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
country: this.country,
isoCountry: this.isoCountry,
outboundSmsPrices: this.outboundSmsPrices,
inboundSmsPrices: this.inboundSmsPrices,
priceUnit: this.priceUnit,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryInstance = CountryInstance;
function CountryListInstance(version) {
const instance = ((isoCountry) => instance.get(isoCountry));
instance.get = function get(isoCountry) {
return new CountryContextImpl(version, isoCountry);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Messaging/Countries`;
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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage extends Page_1.default {
/**
* Initialize the CountryPage
*
* @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 CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CountryInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryPage = CountryPage;

View File

@@ -0,0 +1,18 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { CountryListInstance } from "./phoneNumber/country";
export interface PhoneNumberSolution {
}
export interface PhoneNumberListInstance {
_version: V1;
_solution: PhoneNumberSolution;
_uri: string;
_countries?: CountryListInstance;
countries: CountryListInstance;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function PhoneNumberListInstance(version: V1): PhoneNumberListInstance;

41
node_modules/twilio/lib/rest/pricing/v1/phoneNumber.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.PhoneNumberListInstance = PhoneNumberListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const country_1 = require("./phoneNumber/country");
function PhoneNumberListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/PhoneNumbers`;
Object.defineProperty(instance, "countries", {
get: function countries() {
if (!instance._countries) {
instance._countries = (0, country_1.CountryListInstance)(instance._version);
}
return instance._countries;
},
});
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;
}

View File

@@ -0,0 +1,286 @@
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";
export declare class PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
constructor(payload: any);
}
/**
* Options to pass to each
*/
export interface CountryListInstanceEachOptions {
/** 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: CountryInstance, 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 CountryListInstanceOptions {
/** 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 CountryListInstancePageOptions {
/** 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 CountryContext {
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CountryContextSolution {
isoCountry: string;
}
export declare class CountryContextImpl implements CountryContext {
protected _version: V1;
protected _solution: CountryContextSolution;
protected _uri: string;
constructor(_version: V1, isoCountry: string);
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CountryContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CountryPayload extends TwilioResponsePayload {
countries: CountryResource[];
}
interface CountryResource {
country: string;
iso_country: string;
phone_number_prices: Array<PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices>;
price_unit: string;
url: string;
}
export declare class CountryInstance {
protected _version: V1;
protected _solution: CountryContextSolution;
protected _context?: CountryContext;
constructor(_version: V1, payload: CountryResource, isoCountry?: string);
/**
* The name of the country.
*/
country: string;
/**
* The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
*/
isoCountry: string;
/**
* The list of [PhoneNumberPrice](https://www.twilio.com/docs/phone-numbers/pricing#phone-number-price) records.
*/
phoneNumberPrices: Array<PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices>;
/**
* The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`).
*/
priceUnit: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
country: string;
isoCountry: string;
phoneNumberPrices: PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices[];
priceUnit: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CountrySolution {
}
export interface CountryListInstance {
_version: V1;
_solution: CountrySolution;
_uri: string;
(isoCountry: string): CountryContext;
get(isoCountry: string): CountryContext;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single target page of CountryInstance 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<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
listWithHttpInfo(params: CountryListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
pageWithHttpInfo(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CountryListInstance(version: V1): CountryListInstance;
export declare class CountryPage extends Page<V1, CountryPayload, CountryResource, CountryInstance> {
/**
* Initialize the CountryPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CountrySolution);
/**
* Build an instance of CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CountryResource): CountryInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,272 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.CountryPage = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices = void 0;
exports.CountryListInstance = CountryListInstance;
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 PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.numberType = payload["number_type"];
}
}
exports.PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices = PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices;
class CountryContextImpl {
constructor(_version, isoCountry) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(isoCountry)) {
throw new Error("Parameter 'isoCountry' is not valid.");
}
this._solution = { isoCountry };
this._uri = `/PhoneNumbers/Countries/${isoCountry}`;
}
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 CountryInstance(operationVersion, payload, instance._solution.isoCountry));
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 CountryInstance(operationVersion, response.body, instance._solution.isoCountry),
}));
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.CountryContextImpl = CountryContextImpl;
class CountryInstance {
constructor(_version, payload, isoCountry) {
this._version = _version;
this.country = payload.country;
this.isoCountry = payload.iso_country;
this.phoneNumberPrices =
payload.phone_number_prices !== null &&
payload.phone_number_prices !== undefined
? payload.phone_number_prices.map((payload) => new PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices(payload))
: null;
this.priceUnit = payload.price_unit;
this.url = payload.url;
this._solution = { isoCountry: isoCountry || this.isoCountry };
}
get _proxy() {
this._context =
this._context ||
new CountryContextImpl(this._version, this._solution.isoCountry);
return this._context;
}
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
country: this.country,
isoCountry: this.isoCountry,
phoneNumberPrices: this.phoneNumberPrices,
priceUnit: this.priceUnit,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryInstance = CountryInstance;
function CountryListInstance(version) {
const instance = ((isoCountry) => instance.get(isoCountry));
instance.get = function get(isoCountry) {
return new CountryContextImpl(version, isoCountry);
};
instance._version = version;
instance._solution = {};
instance._uri = `/PhoneNumbers/Countries`;
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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage extends Page_1.default {
/**
* Initialize the CountryPage
*
* @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 CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CountryInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryPage = CountryPage;

21
node_modules/twilio/lib/rest/pricing/v1/voice.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { CountryListInstance } from "./voice/country";
import { NumberListInstance } from "./voice/number";
export interface VoiceSolution {
}
export interface VoiceListInstance {
_version: V1;
_solution: VoiceSolution;
_uri: string;
_countries?: CountryListInstance;
countries: CountryListInstance;
_numbers?: NumberListInstance;
numbers: NumberListInstance;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function VoiceListInstance(version: V1): VoiceListInstance;

50
node_modules/twilio/lib/rest/pricing/v1/voice.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.VoiceListInstance = VoiceListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const country_1 = require("./voice/country");
const number_1 = require("./voice/number");
function VoiceListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Voice`;
Object.defineProperty(instance, "countries", {
get: function countries() {
if (!instance._countries) {
instance._countries = (0, country_1.CountryListInstance)(instance._version);
}
return instance._countries;
},
});
Object.defineProperty(instance, "numbers", {
get: function numbers() {
if (!instance._numbers) {
instance._numbers = (0, number_1.NumberListInstance)(instance._version);
}
return instance._numbers;
},
});
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;
}

View File

@@ -0,0 +1,299 @@
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";
export declare class PricingV1VoiceVoiceCountryInstanceInboundCallPrices {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
constructor(payload: any);
}
export declare class PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices {
"prefixes"?: Array<string>;
"basePrice"?: number;
"currentPrice"?: number;
"friendlyName"?: string;
constructor(payload: any);
}
/**
* Options to pass to each
*/
export interface CountryListInstanceEachOptions {
/** 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: CountryInstance, 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 CountryListInstanceOptions {
/** 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 CountryListInstancePageOptions {
/** 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 CountryContext {
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CountryContextSolution {
isoCountry: string;
}
export declare class CountryContextImpl implements CountryContext {
protected _version: V1;
protected _solution: CountryContextSolution;
protected _uri: string;
constructor(_version: V1, isoCountry: string);
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CountryContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CountryPayload extends TwilioResponsePayload {
countries: CountryResource[];
}
interface CountryResource {
country: string;
iso_country: string;
outbound_prefix_prices: Array<PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices>;
inbound_call_prices: Array<PricingV1VoiceVoiceCountryInstanceInboundCallPrices>;
price_unit: string;
url: string;
}
export declare class CountryInstance {
protected _version: V1;
protected _solution: CountryContextSolution;
protected _context?: CountryContext;
constructor(_version: V1, payload: CountryResource, isoCountry?: string);
/**
* The name of the country.
*/
country: string;
/**
* The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
*/
isoCountry: string;
/**
* The list of OutboundPrefixPrice records, which include a list of the `prefixes`, the `friendly_name`, `base_price`, and the `current_price` for those prefixes.
*/
outboundPrefixPrices: Array<PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices>;
/**
* The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records.
*/
inboundCallPrices: Array<PricingV1VoiceVoiceCountryInstanceInboundCallPrices>;
/**
* The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`).
*/
priceUnit: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
country: string;
isoCountry: string;
outboundPrefixPrices: PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices[];
inboundCallPrices: PricingV1VoiceVoiceCountryInstanceInboundCallPrices[];
priceUnit: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CountrySolution {
}
export interface CountryListInstance {
_version: V1;
_solution: CountrySolution;
_uri: string;
(isoCountry: string): CountryContext;
get(isoCountry: string): CountryContext;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single target page of CountryInstance 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<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
listWithHttpInfo(params: CountryListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
pageWithHttpInfo(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CountryListInstance(version: V1): CountryListInstance;
export declare class CountryPage extends Page<V1, CountryPayload, CountryResource, CountryInstance> {
/**
* Initialize the CountryPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CountrySolution);
/**
* Build an instance of CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CountryResource): CountryInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,287 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.CountryPage = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices = exports.PricingV1VoiceVoiceCountryInstanceInboundCallPrices = void 0;
exports.CountryListInstance = CountryListInstance;
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 PricingV1VoiceVoiceCountryInstanceInboundCallPrices {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.numberType = payload["number_type"];
}
}
exports.PricingV1VoiceVoiceCountryInstanceInboundCallPrices = PricingV1VoiceVoiceCountryInstanceInboundCallPrices;
class PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices {
constructor(payload) {
this.prefixes = payload["prefixes"];
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.friendlyName = payload["friendly_name"];
}
}
exports.PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices = PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices;
class CountryContextImpl {
constructor(_version, isoCountry) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(isoCountry)) {
throw new Error("Parameter 'isoCountry' is not valid.");
}
this._solution = { isoCountry };
this._uri = `/Voice/Countries/${isoCountry}`;
}
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 CountryInstance(operationVersion, payload, instance._solution.isoCountry));
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 CountryInstance(operationVersion, response.body, instance._solution.isoCountry),
}));
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.CountryContextImpl = CountryContextImpl;
class CountryInstance {
constructor(_version, payload, isoCountry) {
this._version = _version;
this.country = payload.country;
this.isoCountry = payload.iso_country;
this.outboundPrefixPrices =
payload.outbound_prefix_prices !== null &&
payload.outbound_prefix_prices !== undefined
? payload.outbound_prefix_prices.map((payload) => new PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices(payload))
: null;
this.inboundCallPrices =
payload.inbound_call_prices !== null &&
payload.inbound_call_prices !== undefined
? payload.inbound_call_prices.map((payload) => new PricingV1VoiceVoiceCountryInstanceInboundCallPrices(payload))
: null;
this.priceUnit = payload.price_unit;
this.url = payload.url;
this._solution = { isoCountry: isoCountry || this.isoCountry };
}
get _proxy() {
this._context =
this._context ||
new CountryContextImpl(this._version, this._solution.isoCountry);
return this._context;
}
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
country: this.country,
isoCountry: this.isoCountry,
outboundPrefixPrices: this.outboundPrefixPrices,
inboundCallPrices: this.inboundCallPrices,
priceUnit: this.priceUnit,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryInstance = CountryInstance;
function CountryListInstance(version) {
const instance = ((isoCountry) => instance.get(isoCountry));
instance.get = function get(isoCountry) {
return new CountryContextImpl(version, isoCountry);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Voice/Countries`;
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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage extends Page_1.default {
/**
* Initialize the CountryPage
*
* @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 CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CountryInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryPage = CountryPage;

View File

@@ -0,0 +1,146 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. If `null`, the Phone Number is not a Twilio number owned by this account.
*/
export declare class PricingV1VoiceVoiceNumberInboundCallPrice {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
constructor(payload: any);
}
/**
* The OutboundCallPrice record, which includes a list of `origination_prefixes` and the `base_price` and `current_price` for those prefixes.
*/
export declare class PricingV1VoiceVoiceNumberOutboundCallPrice {
"basePrice"?: number;
"currentPrice"?: number;
constructor(payload: any);
}
export interface NumberContext {
/**
* Fetch a NumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface NumberContextSolution {
number: string;
}
export declare class NumberContextImpl implements NumberContext {
protected _version: V1;
protected _solution: NumberContextSolution;
protected _uri: string;
constructor(_version: V1, number: string);
fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): NumberContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface NumberResource {
number: string;
country: string;
iso_country: string;
outbound_call_price: PricingV1VoiceVoiceNumberOutboundCallPrice;
inbound_call_price: PricingV1VoiceVoiceNumberInboundCallPrice;
price_unit: string;
url: string;
}
export declare class NumberInstance {
protected _version: V1;
protected _solution: NumberContextSolution;
protected _context?: NumberContext;
constructor(_version: V1, payload: NumberResource, number?: string);
/**
* The phone number.
*/
number: string;
/**
* The name of the country.
*/
country: string;
/**
* The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
*/
isoCountry: string;
outboundCallPrice: PricingV1VoiceVoiceNumberOutboundCallPrice;
inboundCallPrice: PricingV1VoiceVoiceNumberInboundCallPrice;
/**
* The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`).
*/
priceUnit: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a NumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
number: string;
country: string;
isoCountry: string;
outboundCallPrice: PricingV1VoiceVoiceNumberOutboundCallPrice;
inboundCallPrice: PricingV1VoiceVoiceNumberInboundCallPrice;
priceUnit: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface NumberSolution {
}
export interface NumberListInstance {
_version: V1;
_solution: NumberSolution;
_uri: string;
(number: string): NumberContext;
get(number: string): NumberContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function NumberListInstance(version: V1): NumberListInstance;
export {};

179
node_modules/twilio/lib/rest/pricing/v1/voice/number.js generated vendored Normal file
View File

@@ -0,0 +1,179 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.NumberInstance = exports.NumberContextImpl = exports.PricingV1VoiceVoiceNumberOutboundCallPrice = exports.PricingV1VoiceVoiceNumberInboundCallPrice = void 0;
exports.NumberListInstance = NumberListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
/**
* The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. If `null`, the Phone Number is not a Twilio number owned by this account.
*/
class PricingV1VoiceVoiceNumberInboundCallPrice {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.numberType = payload["number_type"];
}
}
exports.PricingV1VoiceVoiceNumberInboundCallPrice = PricingV1VoiceVoiceNumberInboundCallPrice;
/**
* The OutboundCallPrice record, which includes a list of `origination_prefixes` and the `base_price` and `current_price` for those prefixes.
*/
class PricingV1VoiceVoiceNumberOutboundCallPrice {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
}
}
exports.PricingV1VoiceVoiceNumberOutboundCallPrice = PricingV1VoiceVoiceNumberOutboundCallPrice;
class NumberContextImpl {
constructor(_version, number) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(number)) {
throw new Error("Parameter 'number' is not valid.");
}
this._solution = { number };
this._uri = `/Voice/Numbers/${number}`;
}
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 NumberInstance(operationVersion, payload, instance._solution.number));
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 NumberInstance(operationVersion, response.body, instance._solution.number),
}));
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.NumberContextImpl = NumberContextImpl;
class NumberInstance {
constructor(_version, payload, number) {
this._version = _version;
this.number = payload.number;
this.country = payload.country;
this.isoCountry = payload.iso_country;
this.outboundCallPrice =
payload.outbound_call_price !== null &&
payload.outbound_call_price !== undefined
? new PricingV1VoiceVoiceNumberOutboundCallPrice(payload.outbound_call_price)
: null;
this.inboundCallPrice =
payload.inbound_call_price !== null &&
payload.inbound_call_price !== undefined
? new PricingV1VoiceVoiceNumberInboundCallPrice(payload.inbound_call_price)
: null;
this.priceUnit = payload.price_unit;
this.url = payload.url;
this._solution = { number: number || this.number };
}
get _proxy() {
this._context =
this._context ||
new NumberContextImpl(this._version, this._solution.number);
return this._context;
}
/**
* Fetch a NumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a NumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
number: this.number,
country: this.country,
isoCountry: this.isoCountry,
outboundCallPrice: this.outboundCallPrice,
inboundCallPrice: this.inboundCallPrice,
priceUnit: this.priceUnit,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.NumberInstance = NumberInstance;
function NumberListInstance(version) {
const instance = ((number) => instance.get(number));
instance.get = function get(number) {
return new NumberContextImpl(version, number);
};
instance._version = version;
instance._solution = {};
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;
}

300
node_modules/twilio/lib/rest/pricing/v2/country.d.ts generated vendored Normal file
View File

@@ -0,0 +1,300 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class PricingV2TrunkingCountryInstanceOriginatingCallPrices {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
constructor(payload: any);
}
export declare class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices {
"originationPrefixes"?: Array<string>;
"destinationPrefixes"?: Array<string>;
"basePrice"?: number;
"currentPrice"?: number;
"friendlyName"?: string;
constructor(payload: any);
}
/**
* Options to pass to each
*/
export interface CountryListInstanceEachOptions {
/** 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: CountryInstance, 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 CountryListInstanceOptions {
/** 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 CountryListInstancePageOptions {
/** 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 CountryContext {
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CountryContextSolution {
isoCountry: string;
}
export declare class CountryContextImpl implements CountryContext {
protected _version: V2;
protected _solution: CountryContextSolution;
protected _uri: string;
constructor(_version: V2, isoCountry: string);
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CountryContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CountryPayload extends TwilioResponsePayload {
countries: CountryResource[];
}
interface CountryResource {
country: string;
iso_country: string;
terminating_prefix_prices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>;
originating_call_prices: Array<PricingV2TrunkingCountryInstanceOriginatingCallPrices>;
price_unit: string;
url: string;
}
export declare class CountryInstance {
protected _version: V2;
protected _solution: CountryContextSolution;
protected _context?: CountryContext;
constructor(_version: V2, payload: CountryResource, isoCountry?: string);
/**
* The name of the country.
*/
country: string;
/**
* The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
*/
isoCountry: string;
/**
* The list of [TerminatingPrefixPrice](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records.
*/
terminatingPrefixPrices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>;
/**
* The list of [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records.
*/
originatingCallPrices: Array<PricingV2TrunkingCountryInstanceOriginatingCallPrices>;
/**
* The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`).
*/
priceUnit: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
country: string;
isoCountry: string;
terminatingPrefixPrices: PricingV2TrunkingCountryInstanceTerminatingPrefixPrices[];
originatingCallPrices: PricingV2TrunkingCountryInstanceOriginatingCallPrices[];
priceUnit: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CountrySolution {
}
export interface CountryListInstance {
_version: V2;
_solution: CountrySolution;
_uri: string;
(isoCountry: string): CountryContext;
get(isoCountry: string): CountryContext;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single target page of CountryInstance 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<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
listWithHttpInfo(params: CountryListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
pageWithHttpInfo(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CountryListInstance(version: V2): CountryListInstance;
export declare class CountryPage extends Page<V2, CountryPayload, CountryResource, CountryInstance> {
/**
* Initialize the CountryPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: CountrySolution);
/**
* Build an instance of CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CountryResource): CountryInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

288
node_modules/twilio/lib/rest/pricing/v2/country.js generated vendored Normal file
View File

@@ -0,0 +1,288 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.CountryPage = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = exports.PricingV2TrunkingCountryInstanceOriginatingCallPrices = void 0;
exports.CountryListInstance = CountryListInstance;
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 PricingV2TrunkingCountryInstanceOriginatingCallPrices {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.numberType = payload["number_type"];
}
}
exports.PricingV2TrunkingCountryInstanceOriginatingCallPrices = PricingV2TrunkingCountryInstanceOriginatingCallPrices;
class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices {
constructor(payload) {
this.originationPrefixes = payload["origination_prefixes"];
this.destinationPrefixes = payload["destination_prefixes"];
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.friendlyName = payload["friendly_name"];
}
}
exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = PricingV2TrunkingCountryInstanceTerminatingPrefixPrices;
class CountryContextImpl {
constructor(_version, isoCountry) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(isoCountry)) {
throw new Error("Parameter 'isoCountry' is not valid.");
}
this._solution = { isoCountry };
this._uri = `/Trunking/Countries/${isoCountry}`;
}
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 CountryInstance(operationVersion, payload, instance._solution.isoCountry));
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 CountryInstance(operationVersion, response.body, instance._solution.isoCountry),
}));
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.CountryContextImpl = CountryContextImpl;
class CountryInstance {
constructor(_version, payload, isoCountry) {
this._version = _version;
this.country = payload.country;
this.isoCountry = payload.iso_country;
this.terminatingPrefixPrices =
payload.terminating_prefix_prices !== null &&
payload.terminating_prefix_prices !== undefined
? payload.terminating_prefix_prices.map((payload) => new PricingV2TrunkingCountryInstanceTerminatingPrefixPrices(payload))
: null;
this.originatingCallPrices =
payload.originating_call_prices !== null &&
payload.originating_call_prices !== undefined
? payload.originating_call_prices.map((payload) => new PricingV2TrunkingCountryInstanceOriginatingCallPrices(payload))
: null;
this.priceUnit = payload.price_unit;
this.url = payload.url;
this._solution = { isoCountry: isoCountry || this.isoCountry };
}
get _proxy() {
this._context =
this._context ||
new CountryContextImpl(this._version, this._solution.isoCountry);
return this._context;
}
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
country: this.country,
isoCountry: this.isoCountry,
terminatingPrefixPrices: this.terminatingPrefixPrices,
originatingCallPrices: this.originatingCallPrices,
priceUnit: this.priceUnit,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryInstance = CountryInstance;
function CountryListInstance(version) {
const instance = ((isoCountry) => instance.get(isoCountry));
instance.get = function get(isoCountry) {
return new CountryContextImpl(version, isoCountry);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Trunking/Countries`;
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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage extends Page_1.default {
/**
* Initialize the CountryPage
*
* @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 CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CountryInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryPage = CountryPage;

195
node_modules/twilio/lib/rest/pricing/v2/number.d.ts generated vendored Normal file
View File

@@ -0,0 +1,195 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices {
"originationPrefixes"?: Array<string>;
"destinationPrefixes"?: Array<string>;
"basePrice"?: number;
"currentPrice"?: number;
"friendlyName"?: string;
constructor(payload: any);
}
/**
* The [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record.
*/
export declare class PricingV2TrunkingNumberOriginatingCallPrice {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
constructor(payload: any);
}
/**
* Options to pass to fetch a NumberInstance
*/
export interface NumberContextFetchOptions {
/** The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. */
originationNumber?: string;
}
export interface NumberContext {
/**
* Fetch a NumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface NumberContextSolution {
destinationNumber: string;
}
export declare class NumberContextImpl implements NumberContext {
protected _version: V2;
protected _solution: NumberContextSolution;
protected _uri: string;
constructor(_version: V2, destinationNumber: string);
fetch(params?: NumberContextFetchOptions | ((error: Error | null, item?: NumberInstance) => any), callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
fetchWithHttpInfo(params?: NumberContextFetchOptions | ((error: Error | null, item?: ApiResponse<NumberInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): NumberContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface NumberResource {
destination_number: string;
origination_number: string;
country: string;
iso_country: string;
terminating_prefix_prices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>;
originating_call_price: PricingV2TrunkingNumberOriginatingCallPrice;
price_unit: string;
url: string;
}
export declare class NumberInstance {
protected _version: V2;
protected _solution: NumberContextSolution;
protected _context?: NumberContext;
constructor(_version: V2, payload: NumberResource, destinationNumber?: string);
/**
* The destination 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.
*/
destinationNumber: string;
/**
* The origination 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.
*/
originationNumber: string;
/**
* The name of the country.
*/
country: string;
/**
* The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
*/
isoCountry: string;
terminatingPrefixPrices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>;
originatingCallPrice: PricingV2TrunkingNumberOriginatingCallPrice;
/**
* The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`).
*/
priceUnit: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a NumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
destinationNumber: string;
originationNumber: string;
country: string;
isoCountry: string;
terminatingPrefixPrices: PricingV2TrunkingCountryInstanceTerminatingPrefixPrices[];
originatingCallPrice: PricingV2TrunkingNumberOriginatingCallPrice;
priceUnit: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface NumberSolution {
}
export interface NumberListInstance {
_version: V2;
_solution: NumberSolution;
_uri: string;
(destinationNumber: string): NumberContext;
get(destinationNumber: string): NumberContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function NumberListInstance(version: V2): NumberListInstance;
export {};

191
node_modules/twilio/lib/rest/pricing/v2/number.js generated vendored Normal file
View File

@@ -0,0 +1,191 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.NumberInstance = exports.NumberContextImpl = exports.PricingV2TrunkingNumberOriginatingCallPrice = exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = void 0;
exports.NumberListInstance = NumberListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices {
constructor(payload) {
this.originationPrefixes = payload["origination_prefixes"];
this.destinationPrefixes = payload["destination_prefixes"];
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.friendlyName = payload["friendly_name"];
}
}
exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = PricingV2TrunkingCountryInstanceTerminatingPrefixPrices;
/**
* The [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record.
*/
class PricingV2TrunkingNumberOriginatingCallPrice {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.numberType = payload["number_type"];
}
}
exports.PricingV2TrunkingNumberOriginatingCallPrice = PricingV2TrunkingNumberOriginatingCallPrice;
class NumberContextImpl {
constructor(_version, destinationNumber) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(destinationNumber)) {
throw new Error("Parameter 'destinationNumber' is not valid.");
}
this._solution = { destinationNumber };
this._uri = `/Trunking/Numbers/${destinationNumber}`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["originationNumber"] !== undefined)
data["OriginationNumber"] = params["originationNumber"];
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new NumberInstance(operationVersion, payload, instance._solution.destinationNumber));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["originationNumber"] !== undefined)
data["OriginationNumber"] = params["originationNumber"];
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",
params: data,
headers,
})
.then((response) => ({
...response,
body: new NumberInstance(operationVersion, response.body, instance._solution.destinationNumber),
}));
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.NumberContextImpl = NumberContextImpl;
class NumberInstance {
constructor(_version, payload, destinationNumber) {
this._version = _version;
this.destinationNumber = payload.destination_number;
this.originationNumber = payload.origination_number;
this.country = payload.country;
this.isoCountry = payload.iso_country;
this.terminatingPrefixPrices =
payload.terminating_prefix_prices !== null &&
payload.terminating_prefix_prices !== undefined
? payload.terminating_prefix_prices.map((payload) => new PricingV2TrunkingCountryInstanceTerminatingPrefixPrices(payload))
: null;
this.originatingCallPrice =
payload.originating_call_price !== null &&
payload.originating_call_price !== undefined
? new PricingV2TrunkingNumberOriginatingCallPrice(payload.originating_call_price)
: null;
this.priceUnit = payload.price_unit;
this.url = payload.url;
this._solution = {
destinationNumber: destinationNumber || this.destinationNumber,
};
}
get _proxy() {
this._context =
this._context ||
new NumberContextImpl(this._version, this._solution.destinationNumber);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
destinationNumber: this.destinationNumber,
originationNumber: this.originationNumber,
country: this.country,
isoCountry: this.isoCountry,
terminatingPrefixPrices: this.terminatingPrefixPrices,
originatingCallPrice: this.originatingCallPrice,
priceUnit: this.priceUnit,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.NumberInstance = NumberInstance;
function NumberListInstance(version) {
const instance = ((destinationNumber) => instance.get(destinationNumber));
instance.get = function get(destinationNumber) {
return new NumberContextImpl(version, destinationNumber);
};
instance._version = version;
instance._solution = {};
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;
}

21
node_modules/twilio/lib/rest/pricing/v2/voice.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { CountryListInstance } from "./voice/country";
import { NumberListInstance } from "./voice/number";
export interface VoiceSolution {
}
export interface VoiceListInstance {
_version: V2;
_solution: VoiceSolution;
_uri: string;
_countries?: CountryListInstance;
countries: CountryListInstance;
_numbers?: NumberListInstance;
numbers: NumberListInstance;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function VoiceListInstance(version: V2): VoiceListInstance;

50
node_modules/twilio/lib/rest/pricing/v2/voice.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.VoiceListInstance = VoiceListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const country_1 = require("./voice/country");
const number_1 = require("./voice/number");
function VoiceListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Voice`;
Object.defineProperty(instance, "countries", {
get: function countries() {
if (!instance._countries) {
instance._countries = (0, country_1.CountryListInstance)(instance._version);
}
return instance._countries;
},
});
Object.defineProperty(instance, "numbers", {
get: function numbers() {
if (!instance._numbers) {
instance._numbers = (0, number_1.NumberListInstance)(instance._version);
}
return instance._numbers;
},
});
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;
}

View File

@@ -0,0 +1,300 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V2 from "../../V2";
import { ApiResponse } from "../../../../base/ApiResponse";
export declare class PricingV2TrunkingCountryInstanceOriginatingCallPrices {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
constructor(payload: any);
}
export declare class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices {
"originationPrefixes"?: Array<string>;
"destinationPrefixes"?: Array<string>;
"basePrice"?: number;
"currentPrice"?: number;
"friendlyName"?: string;
constructor(payload: any);
}
/**
* Options to pass to each
*/
export interface CountryListInstanceEachOptions {
/** 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: CountryInstance, 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 CountryListInstanceOptions {
/** 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 CountryListInstancePageOptions {
/** 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 CountryContext {
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CountryContextSolution {
isoCountry: string;
}
export declare class CountryContextImpl implements CountryContext {
protected _version: V2;
protected _solution: CountryContextSolution;
protected _uri: string;
constructor(_version: V2, isoCountry: string);
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CountryContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CountryPayload extends TwilioResponsePayload {
countries: CountryResource[];
}
interface CountryResource {
country: string;
iso_country: string;
outbound_prefix_prices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>;
inbound_call_prices: Array<PricingV2TrunkingCountryInstanceOriginatingCallPrices>;
price_unit: string;
url: string;
}
export declare class CountryInstance {
protected _version: V2;
protected _solution: CountryContextSolution;
protected _context?: CountryContext;
constructor(_version: V2, payload: CountryResource, isoCountry?: string);
/**
* The name of the country.
*/
country: string;
/**
* The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
*/
isoCountry: string;
/**
* The list of [OutboundPrefixPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records.
*/
outboundPrefixPrices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>;
/**
* The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records.
*/
inboundCallPrices: Array<PricingV2TrunkingCountryInstanceOriginatingCallPrices>;
/**
* The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`).
*/
priceUnit: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>;
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CountryInstance>) => any): Promise<ApiResponse<CountryInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
country: string;
isoCountry: string;
outboundPrefixPrices: PricingV2TrunkingCountryInstanceTerminatingPrefixPrices[];
inboundCallPrices: PricingV2TrunkingCountryInstanceOriginatingCallPrices[];
priceUnit: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CountrySolution {
}
export interface CountryListInstance {
_version: V2;
_solution: CountrySolution;
_uri: string;
(isoCountry: string): CountryContext;
get(isoCountry: string): CountryContext;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single target page of CountryInstance 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<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>;
/**
* Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
listWithHttpInfo(params: CountryListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CountryInstance[]>) => any): Promise<ApiResponse<CountryInstance[]>>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>;
/**
* Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
pageWithHttpInfo(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CountryPage>) => any): Promise<ApiResponse<CountryPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CountryListInstance(version: V2): CountryListInstance;
export declare class CountryPage extends Page<V2, CountryPayload, CountryResource, CountryInstance> {
/**
* Initialize the CountryPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: CountrySolution);
/**
* Build an instance of CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CountryResource): CountryInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,288 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.CountryPage = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = exports.PricingV2TrunkingCountryInstanceOriginatingCallPrices = void 0;
exports.CountryListInstance = CountryListInstance;
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 PricingV2TrunkingCountryInstanceOriginatingCallPrices {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.numberType = payload["number_type"];
}
}
exports.PricingV2TrunkingCountryInstanceOriginatingCallPrices = PricingV2TrunkingCountryInstanceOriginatingCallPrices;
class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices {
constructor(payload) {
this.originationPrefixes = payload["origination_prefixes"];
this.destinationPrefixes = payload["destination_prefixes"];
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.friendlyName = payload["friendly_name"];
}
}
exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = PricingV2TrunkingCountryInstanceTerminatingPrefixPrices;
class CountryContextImpl {
constructor(_version, isoCountry) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(isoCountry)) {
throw new Error("Parameter 'isoCountry' is not valid.");
}
this._solution = { isoCountry };
this._uri = `/Voice/Countries/${isoCountry}`;
}
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 CountryInstance(operationVersion, payload, instance._solution.isoCountry));
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 CountryInstance(operationVersion, response.body, instance._solution.isoCountry),
}));
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.CountryContextImpl = CountryContextImpl;
class CountryInstance {
constructor(_version, payload, isoCountry) {
this._version = _version;
this.country = payload.country;
this.isoCountry = payload.iso_country;
this.outboundPrefixPrices =
payload.outbound_prefix_prices !== null &&
payload.outbound_prefix_prices !== undefined
? payload.outbound_prefix_prices.map((payload) => new PricingV2TrunkingCountryInstanceTerminatingPrefixPrices(payload))
: null;
this.inboundCallPrices =
payload.inbound_call_prices !== null &&
payload.inbound_call_prices !== undefined
? payload.inbound_call_prices.map((payload) => new PricingV2TrunkingCountryInstanceOriginatingCallPrices(payload))
: null;
this.priceUnit = payload.price_unit;
this.url = payload.url;
this._solution = { isoCountry: isoCountry || this.isoCountry };
}
get _proxy() {
this._context =
this._context ||
new CountryContextImpl(this._version, this._solution.isoCountry);
return this._context;
}
/**
* Fetch a CountryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CountryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CountryInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
country: this.country,
isoCountry: this.isoCountry,
outboundPrefixPrices: this.outboundPrefixPrices,
inboundCallPrices: this.inboundCallPrices,
priceUnit: this.priceUnit,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryInstance = CountryInstance;
function CountryListInstance(version) {
const instance = ((isoCountry) => instance.get(isoCountry));
instance.get = function get(isoCountry) {
return new CountryContextImpl(version, isoCountry);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Voice/Countries`;
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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage(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 CountryPage extends Page_1.default {
/**
* Initialize the CountryPage
*
* @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 CountryInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CountryInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CountryPage = CountryPage;

View File

@@ -0,0 +1,196 @@
import { inspect, InspectOptions } from "util";
import V2 from "../../V2";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record.
*/
export declare class PricingV2VoiceVoiceNumberInboundCallPrice {
"basePrice"?: number;
"currentPrice"?: number;
"numberType"?: string;
constructor(payload: any);
}
export declare class PricingV2VoiceVoiceNumberOutboundCallPrices {
"basePrice"?: number;
"currentPrice"?: number;
"originationPrefixes"?: Array<string>;
constructor(payload: any);
}
/**
* Options to pass to fetch a NumberInstance
*/
export interface NumberContextFetchOptions {
/** The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. */
originationNumber?: string;
}
export interface NumberContext {
/**
* Fetch a NumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface NumberContextSolution {
destinationNumber: string;
}
export declare class NumberContextImpl implements NumberContext {
protected _version: V2;
protected _solution: NumberContextSolution;
protected _uri: string;
constructor(_version: V2, destinationNumber: string);
fetch(params?: NumberContextFetchOptions | ((error: Error | null, item?: NumberInstance) => any), callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
fetchWithHttpInfo(params?: NumberContextFetchOptions | ((error: Error | null, item?: ApiResponse<NumberInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): NumberContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface NumberResource {
destination_number: string;
origination_number: string;
country: string;
iso_country: string;
outbound_call_prices: Array<PricingV2VoiceVoiceNumberOutboundCallPrices>;
inbound_call_price: PricingV2VoiceVoiceNumberInboundCallPrice;
price_unit: string;
url: string;
}
export declare class NumberInstance {
protected _version: V2;
protected _solution: NumberContextSolution;
protected _context?: NumberContext;
constructor(_version: V2, payload: NumberResource, destinationNumber?: string);
/**
* The destination 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.
*/
destinationNumber: string;
/**
* The origination 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.
*/
originationNumber: string;
/**
* The name of the country.
*/
country: string;
/**
* The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
*/
isoCountry: string;
/**
* The list of [OutboundCallPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-call-price-with-origin) records.
*/
outboundCallPrices: Array<PricingV2VoiceVoiceNumberOutboundCallPrices>;
inboundCallPrice: PricingV2VoiceVoiceNumberInboundCallPrice;
/**
* The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`).
*/
priceUnit: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a NumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance
*/
fetch(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Fetch a NumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NumberInstance with HTTP metadata
*/
fetchWithHttpInfo(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<NumberInstance>) => any): Promise<ApiResponse<NumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
destinationNumber: string;
originationNumber: string;
country: string;
isoCountry: string;
outboundCallPrices: PricingV2VoiceVoiceNumberOutboundCallPrices[];
inboundCallPrice: PricingV2VoiceVoiceNumberInboundCallPrice;
priceUnit: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface NumberSolution {
}
export interface NumberListInstance {
_version: V2;
_solution: NumberSolution;
_uri: string;
(destinationNumber: string): NumberContext;
get(destinationNumber: string): NumberContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function NumberListInstance(version: V2): NumberListInstance;
export {};

189
node_modules/twilio/lib/rest/pricing/v2/voice/number.js generated vendored Normal file
View File

@@ -0,0 +1,189 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Pricing
* 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.NumberInstance = exports.NumberContextImpl = exports.PricingV2VoiceVoiceNumberOutboundCallPrices = exports.PricingV2VoiceVoiceNumberInboundCallPrice = void 0;
exports.NumberListInstance = NumberListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
/**
* The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record.
*/
class PricingV2VoiceVoiceNumberInboundCallPrice {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.numberType = payload["number_type"];
}
}
exports.PricingV2VoiceVoiceNumberInboundCallPrice = PricingV2VoiceVoiceNumberInboundCallPrice;
class PricingV2VoiceVoiceNumberOutboundCallPrices {
constructor(payload) {
this.basePrice = payload["base_price"];
this.currentPrice = payload["current_price"];
this.originationPrefixes = payload["origination_prefixes"];
}
}
exports.PricingV2VoiceVoiceNumberOutboundCallPrices = PricingV2VoiceVoiceNumberOutboundCallPrices;
class NumberContextImpl {
constructor(_version, destinationNumber) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(destinationNumber)) {
throw new Error("Parameter 'destinationNumber' is not valid.");
}
this._solution = { destinationNumber };
this._uri = `/Voice/Numbers/${destinationNumber}`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["originationNumber"] !== undefined)
data["OriginationNumber"] = params["originationNumber"];
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new NumberInstance(operationVersion, payload, instance._solution.destinationNumber));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["originationNumber"] !== undefined)
data["OriginationNumber"] = params["originationNumber"];
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",
params: data,
headers,
})
.then((response) => ({
...response,
body: new NumberInstance(operationVersion, response.body, instance._solution.destinationNumber),
}));
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.NumberContextImpl = NumberContextImpl;
class NumberInstance {
constructor(_version, payload, destinationNumber) {
this._version = _version;
this.destinationNumber = payload.destination_number;
this.originationNumber = payload.origination_number;
this.country = payload.country;
this.isoCountry = payload.iso_country;
this.outboundCallPrices =
payload.outbound_call_prices !== null &&
payload.outbound_call_prices !== undefined
? payload.outbound_call_prices.map((payload) => new PricingV2VoiceVoiceNumberOutboundCallPrices(payload))
: null;
this.inboundCallPrice =
payload.inbound_call_price !== null &&
payload.inbound_call_price !== undefined
? new PricingV2VoiceVoiceNumberInboundCallPrice(payload.inbound_call_price)
: null;
this.priceUnit = payload.price_unit;
this.url = payload.url;
this._solution = {
destinationNumber: destinationNumber || this.destinationNumber,
};
}
get _proxy() {
this._context =
this._context ||
new NumberContextImpl(this._version, this._solution.destinationNumber);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
destinationNumber: this.destinationNumber,
originationNumber: this.originationNumber,
country: this.country,
isoCountry: this.isoCountry,
outboundCallPrices: this.outboundCallPrices,
inboundCallPrice: this.inboundCallPrice,
priceUnit: this.priceUnit,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.NumberInstance = NumberInstance;
function NumberListInstance(version) {
const instance = ((destinationNumber) => instance.get(destinationNumber));
instance.get = function get(destinationNumber) {
return new NumberContextImpl(version, destinationNumber);
};
instance._version = version;
instance._solution = {};
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;
}