Auto-commit 2026-04-29 16:31

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

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

@@ -0,0 +1,15 @@
import LookupsBase from "../LookupsBase";
import Version from "../../base/Version";
import { PhoneNumberListInstance } from "./v1/phoneNumber";
export default class V1 extends Version {
/**
* Initialize the V1 version of Lookups
*
* @param domain - The Twilio (Twilio.Lookups) domain
*/
constructor(domain: LookupsBase);
/** phoneNumbers - { Twilio.Lookups.V1.PhoneNumberListInstance } resource */
protected _phoneNumbers?: PhoneNumberListInstance;
/** Getter for phoneNumbers resource */
get phoneNumbers(): PhoneNumberListInstance;
}

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

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

35
node_modules/twilio/lib/rest/lookups/V2.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import LookupsBase from "../LookupsBase";
import Version from "../../base/Version";
import { BucketListInstance } from "./v2/bucket";
import { LookupOverrideListInstance } from "./v2/lookupOverride";
import { PhoneNumberListInstance } from "./v2/phoneNumber";
import { QueryListInstance } from "./v2/query";
import { RateLimitListInstance } from "./v2/rateLimit";
export default class V2 extends Version {
/**
* Initialize the V2 version of Lookups
*
* @param domain - The Twilio (Twilio.Lookups) domain
*/
constructor(domain: LookupsBase);
/** bucket - { Twilio.Lookups.V2.BucketListInstance } resource */
protected _bucket?: BucketListInstance;
/** lookupOverrides - { Twilio.Lookups.V2.LookupOverrideListInstance } resource */
protected _lookupOverrides?: LookupOverrideListInstance;
/** phoneNumbers - { Twilio.Lookups.V2.PhoneNumberListInstance } resource */
protected _phoneNumbers?: PhoneNumberListInstance;
/** query - { Twilio.Lookups.V2.QueryListInstance } resource */
protected _query?: QueryListInstance;
/** rateLimits - { Twilio.Lookups.V2.RateLimitListInstance } resource */
protected _rateLimits?: RateLimitListInstance;
/** Getter for bucket resource */
get bucket(): BucketListInstance;
/** Getter for lookupOverrides resource */
get lookupOverrides(): LookupOverrideListInstance;
/** Getter for phoneNumbers resource */
get phoneNumbers(): PhoneNumberListInstance;
/** Getter for query resource */
get query(): QueryListInstance;
/** Getter for rateLimits resource */
get rateLimits(): RateLimitListInstance;
}

61
node_modules/twilio/lib/rest/lookups/V2.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Lookups
* 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 bucket_1 = require("./v2/bucket");
const lookupOverride_1 = require("./v2/lookupOverride");
const phoneNumber_1 = require("./v2/phoneNumber");
const query_1 = require("./v2/query");
const rateLimit_1 = require("./v2/rateLimit");
class V2 extends Version_1.default {
/**
* Initialize the V2 version of Lookups
*
* @param domain - The Twilio (Twilio.Lookups) domain
*/
constructor(domain) {
super(domain, "v2");
}
/** Getter for bucket resource */
get bucket() {
this._bucket = this._bucket || (0, bucket_1.BucketListInstance)(this);
return this._bucket;
}
/** Getter for lookupOverrides resource */
get lookupOverrides() {
this._lookupOverrides =
this._lookupOverrides || (0, lookupOverride_1.LookupOverrideListInstance)(this);
return this._lookupOverrides;
}
/** Getter for phoneNumbers resource */
get phoneNumbers() {
this._phoneNumbers = this._phoneNumbers || (0, phoneNumber_1.PhoneNumberListInstance)(this);
return this._phoneNumbers;
}
/** Getter for query resource */
get query() {
this._query = this._query || (0, query_1.QueryListInstance)(this);
return this._query;
}
/** Getter for rateLimits resource */
get rateLimits() {
this._rateLimits = this._rateLimits || (0, rateLimit_1.RateLimitListInstance)(this);
return this._rateLimits;
}
}
exports.default = V2;

View File

@@ -0,0 +1,184 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to fetch a PhoneNumberInstance
*/
export interface PhoneNumberContextFetchOptions {
/** The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format. */
countryCode?: string;
/** The type of information to return. Can be: `carrier` or `caller-name`. The default is null. To retrieve both types of information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. */
type?: Array<string>;
/** The `unique_name` of an Add-on you would like to invoke. Can be the `unique_name` of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the [Add-ons documentation](https://www.twilio.com/docs/add-ons). */
addOns?: Array<string>;
/** Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on. */
addOnsData?: Record<string, object>;
}
export interface PhoneNumberContext {
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface PhoneNumberContextSolution {
phoneNumber: string;
}
export declare class PhoneNumberContextImpl implements PhoneNumberContext {
protected _version: V1;
protected _solution: PhoneNumberContextSolution;
protected _uri: string;
constructor(_version: V1, phoneNumber: string);
fetch(params?: PhoneNumberContextFetchOptions | ((error: Error | null, item?: PhoneNumberInstance) => any), callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
fetchWithHttpInfo(params?: PhoneNumberContextFetchOptions | ((error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): PhoneNumberContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface PhoneNumberResource {
caller_name: any;
country_code: string;
phone_number: string;
national_format: string;
carrier: any;
add_ons: any;
url: string;
}
export declare class PhoneNumberInstance {
protected _version: V1;
protected _solution: PhoneNumberContextSolution;
protected _context?: PhoneNumberContext;
constructor(_version: V1, payload: PhoneNumberResource, phoneNumber?: string);
/**
* The name of the phone number\'s owner. If `null`, that information was not available.
*/
callerName: any;
/**
* The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) for the phone number.
*/
countryCode: string;
/**
* The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.
*/
phoneNumber: string;
/**
* The phone number, in national format.
*/
nationalFormat: string;
/**
* The telecom company that provides the phone number.
*/
carrier: any;
/**
* A JSON string with the results of the Add-ons you specified in the `add_ons` parameters. For the format of the object, see [Using Add-ons](https://www.twilio.com/docs/add-ons).
*/
addOns: any;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
callerName: any;
countryCode: string;
phoneNumber: string;
nationalFormat: string;
carrier: any;
addOns: any;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface PhoneNumberSolution {
}
export interface PhoneNumberListInstance {
_version: V1;
_solution: PhoneNumberSolution;
_uri: string;
(phoneNumber: string): PhoneNumberContext;
get(phoneNumber: string): PhoneNumberContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function PhoneNumberListInstance(version: V1): PhoneNumberListInstance;
export {};

176
node_modules/twilio/lib/rest/lookups/v1/phoneNumber.js generated vendored Normal file
View File

@@ -0,0 +1,176 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Lookups
* 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.PhoneNumberInstance = exports.PhoneNumberContextImpl = void 0;
exports.PhoneNumberListInstance = PhoneNumberListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class PhoneNumberContextImpl {
constructor(_version, phoneNumber) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(phoneNumber)) {
throw new Error("Parameter 'phoneNumber' is not valid.");
}
this._solution = { phoneNumber };
this._uri = `/PhoneNumbers/${phoneNumber}`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["countryCode"] !== undefined)
data["CountryCode"] = params["countryCode"];
if (params["type"] !== undefined)
data["Type"] = serialize.map(params["type"], (e) => e);
if (params["addOns"] !== undefined)
data["AddOns"] = serialize.map(params["addOns"], (e) => e);
if (params["addOnsData"] !== undefined)
data = {
...data,
...serialize.prefixedCollapsibleMap(params["addOnsData"], "AddOns"),
};
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 PhoneNumberInstance(operationVersion, payload, instance._solution.phoneNumber));
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["countryCode"] !== undefined)
data["CountryCode"] = params["countryCode"];
if (params["type"] !== undefined)
data["Type"] = serialize.map(params["type"], (e) => e);
if (params["addOns"] !== undefined)
data["AddOns"] = serialize.map(params["addOns"], (e) => e);
if (params["addOnsData"] !== undefined)
data = {
...data,
...serialize.prefixedCollapsibleMap(params["addOnsData"], "AddOns"),
};
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 PhoneNumberInstance(operationVersion, response.body, instance._solution.phoneNumber),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberContextImpl = PhoneNumberContextImpl;
class PhoneNumberInstance {
constructor(_version, payload, phoneNumber) {
this._version = _version;
this.callerName = payload.caller_name;
this.countryCode = payload.country_code;
this.phoneNumber = payload.phone_number;
this.nationalFormat = payload.national_format;
this.carrier = payload.carrier;
this.addOns = payload.add_ons;
this.url = payload.url;
this._solution = { phoneNumber: phoneNumber || this.phoneNumber };
}
get _proxy() {
this._context =
this._context ||
new PhoneNumberContextImpl(this._version, this._solution.phoneNumber);
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 {
callerName: this.callerName,
countryCode: this.countryCode,
phoneNumber: this.phoneNumber,
nationalFormat: this.nationalFormat,
carrier: this.carrier,
addOns: this.addOns,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberInstance = PhoneNumberInstance;
function PhoneNumberListInstance(version) {
const instance = ((phoneNumber) => instance.get(phoneNumber));
instance.get = function get(phoneNumber) {
return new PhoneNumberContextImpl(version, phoneNumber);
};
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;
}

277
node_modules/twilio/lib/rest/lookups/v2/bucket.d.ts generated vendored Normal file
View File

@@ -0,0 +1,277 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Rate limit request schema
*/
export declare class RateLimitRequest {
/**
* Limit of requests for the bucket
*/
"limit"?: number;
/**
* Time to live of the rule
*/
"ttl"?: number;
constructor(payload: any);
}
/**
* Options to pass to update a BucketInstance
*/
export interface BucketContextUpdateOptions {
/** */
rateLimitRequest?: RateLimitRequest;
}
export interface BucketContext {
/**
* Remove a BucketInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a BucketInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a BucketInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance
*/
fetch(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>;
/**
* Fetch a BucketInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BucketInstance>) => any): Promise<ApiResponse<BucketInstance>>;
/**
* Update a BucketInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance
*/
update(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>;
/**
* Update a BucketInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance
*/
update(params: RateLimitRequest, headers?: any, callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>;
/**
* Update a BucketInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BucketInstance>) => any): Promise<ApiResponse<BucketInstance>>;
/**
* Update a BucketInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance with HTTP metadata
*/
updateWithHttpInfo(params: RateLimitRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<BucketInstance>) => any): Promise<ApiResponse<BucketInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface BucketContextSolution {
field: string;
bucket: string;
}
export declare class BucketContextImpl implements BucketContext {
protected _version: V2;
protected _solution: BucketContextSolution;
protected _uri: string;
constructor(_version: V2, field: string, bucket: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BucketInstance>) => any): Promise<ApiResponse<BucketInstance>>;
update(params?: RateLimitRequest | ((error: Error | null, item?: BucketInstance) => any), headers?: any, callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>;
updateWithHttpInfo(params?: RateLimitRequest | ((error: Error | null, item?: ApiResponse<BucketInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<BucketInstance>) => any): Promise<ApiResponse<BucketInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): BucketContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface BucketResource {
code: number;
message: string;
more_info: string;
status: number;
field: string;
limit: number;
bucket: string;
owner: string;
ttl: number;
}
export declare class BucketInstance {
protected _version: V2;
protected _solution: BucketContextSolution;
protected _context?: BucketContext;
constructor(_version: V2, payload: BucketResource, field?: string, bucket?: string);
/**
* Twilio-specific error code
*/
code: number;
/**
* Error message
*/
message: string;
/**
* Link to Error Code References
*/
moreInfo: string;
/**
* HTTP response status code
*/
status: number;
/**
* Limit of requests for the bucket
*/
field: string;
/**
* Limit of requests for the bucket
*/
limit: number;
/**
* Name of the bucket
*/
bucket: string;
/**
* Owner of the rule
*/
owner: string;
/**
* Time to live of the rule
*/
ttl: number;
private get _proxy();
/**
* Remove a BucketInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a BucketInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a BucketInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance
*/
fetch(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>;
/**
* Fetch a BucketInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BucketInstance>) => any): Promise<ApiResponse<BucketInstance>>;
/**
* Update a BucketInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance
*/
update(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>;
/**
* Update a BucketInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance
*/
update(params: RateLimitRequest, headers?: any, callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>;
/**
* Update a BucketInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<BucketInstance>) => any): Promise<ApiResponse<BucketInstance>>;
/**
* Update a BucketInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance with HTTP metadata
*/
updateWithHttpInfo(params: RateLimitRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<BucketInstance>) => any): Promise<ApiResponse<BucketInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
code: number;
message: string;
moreInfo: string;
status: number;
field: string;
limit: number;
bucket: string;
owner: string;
ttl: number;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface BucketSolution {
}
export interface BucketListInstance {
_version: V2;
_solution: BucketSolution;
_uri: string;
(field: string, bucket: string): BucketContext;
get(field: string, bucket: string): BucketContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function BucketListInstance(version: V2): BucketListInstance;
export {};

279
node_modules/twilio/lib/rest/lookups/v2/bucket.js generated vendored Normal file
View File

@@ -0,0 +1,279 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Lookups
* 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.BucketInstance = exports.BucketContextImpl = exports.RateLimitRequest = void 0;
exports.BucketListInstance = BucketListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
/**
* Rate limit request schema
*/
class RateLimitRequest {
constructor(payload) {
this.limit = payload["limit"];
this.ttl = payload["ttl"];
}
}
exports.RateLimitRequest = RateLimitRequest;
class BucketContextImpl {
constructor(_version, field, bucket) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(field)) {
throw new Error("Parameter 'field' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(bucket)) {
throw new Error("Parameter 'bucket' is not valid.");
}
this._solution = { field, bucket };
this._uri = `/RateLimits/Fields/${field}/Bucket/${bucket}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new BucketInstance(operationVersion, payload, instance._solution.field, instance._solution.bucket));
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 BucketInstance(operationVersion, response.body, instance._solution.field, instance._solution.bucket),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "put",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new BucketInstance(operationVersion, payload, instance._solution.field, instance._solution.bucket));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "put",
data,
headers,
})
.then((response) => ({
...response,
body: new BucketInstance(operationVersion, response.body, instance._solution.field, instance._solution.bucket),
}));
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.BucketContextImpl = BucketContextImpl;
class BucketInstance {
constructor(_version, payload, field, bucket) {
this._version = _version;
this.code = payload.code;
this.message = payload.message;
this.moreInfo = payload.more_info;
this.status = payload.status;
this.field = payload.field;
this.limit = payload.limit;
this.bucket = payload.bucket;
this.owner = payload.owner;
this.ttl = payload.ttl;
this._solution = {
field: field || this.field,
bucket: bucket || this.bucket,
};
}
get _proxy() {
this._context =
this._context ||
new BucketContextImpl(this._version, this._solution.field, this._solution.bucket);
return this._context;
}
/**
* Remove a BucketInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a BucketInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a BucketInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a BucketInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BucketInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
code: this.code,
message: this.message,
moreInfo: this.moreInfo,
status: this.status,
field: this.field,
limit: this.limit,
bucket: this.bucket,
owner: this.owner,
ttl: this.ttl,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BucketInstance = BucketInstance;
function BucketListInstance(version) {
const instance = ((field, bucket) => instance.get(field, bucket));
instance.get = function get(field, bucket) {
return new BucketContextImpl(version, field, bucket);
};
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;
}

View File

@@ -0,0 +1,388 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class OverridesRequest {
/**
* The new line type to override the original line type
*/
"lineType"?: string;
/**
* The reason for the override
*/
"reason"?: string;
constructor(payload: any);
}
/**
* Options to pass to create a LookupOverrideInstance
*/
export interface LookupOverrideContextCreateOptions {
/** */
overridesRequest?: OverridesRequest;
}
/**
* Options to pass to update a LookupOverrideInstance
*/
export interface LookupOverrideContextUpdateOptions {
/** */
overridesRequest?: OverridesRequest;
}
export interface LookupOverrideContext {
/**
* Create a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
create(callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Create a LookupOverrideInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
create(params: OverridesRequest, headers?: any, callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Create a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Create a LookupOverrideInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
createWithHttpInfo(params: OverridesRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Remove a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
fetch(callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Fetch a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Update a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
update(callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Update a LookupOverrideInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
update(params: OverridesRequest, headers?: any, callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Update a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Update a LookupOverrideInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
updateWithHttpInfo(params: OverridesRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface LookupOverrideContextSolution {
field: string;
phoneNumber: string;
}
export declare class LookupOverrideContextImpl implements LookupOverrideContext {
protected _version: V2;
protected _solution: LookupOverrideContextSolution;
protected _uri: string;
constructor(_version: V2, field: string, phoneNumber: string);
create(params?: OverridesRequest | ((error: Error | null, item?: LookupOverrideInstance) => any), headers?: any, callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
createWithHttpInfo(params?: OverridesRequest | ((error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
update(params?: OverridesRequest | ((error: Error | null, item?: LookupOverrideInstance) => any), headers?: any, callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
updateWithHttpInfo(params?: OverridesRequest | ((error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): LookupOverrideContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface LookupOverrideResource {
phone_number: string;
original_line_type: string;
overridden_line_type: string;
override_reason: string;
override_timestamp: Date;
overridden_by_account_sid: string;
code: number;
message: string;
more_info: string;
status: number;
field: string;
limit: number;
bucket: string;
owner: string;
ttl: number;
}
export declare class LookupOverrideInstance {
protected _version: V2;
protected _solution: LookupOverrideContextSolution;
protected _context?: LookupOverrideContext;
constructor(_version: V2, payload: LookupOverrideResource, field?: string, phoneNumber?: string);
/**
* The phone number for which the override was created
*/
phoneNumber: string;
/**
* The original line type
*/
originalLineType: string;
/**
* The new line type after the override
*/
overriddenLineType: string;
/**
* The reason for the override
*/
overrideReason: string;
overrideTimestamp: Date;
/**
* The Account SID for the user who made the override
*/
overriddenByAccountSid: string;
/**
* Twilio-specific error code
*/
code: number;
/**
* Error message
*/
message: string;
/**
* Link to Error Code References
*/
moreInfo: string;
/**
* HTTP response status code
*/
status: number;
/**
* Limit of requests for the bucket
*/
field: string;
/**
* Limit of requests for the bucket
*/
limit: number;
/**
* Name of the bucket
*/
bucket: string;
/**
* Owner of the rule
*/
owner: string;
/**
* Time to live of the rule
*/
ttl: number;
private get _proxy();
/**
* Create a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
create(callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Create a LookupOverrideInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
create(params: OverridesRequest, headers?: any, callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Create a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Create a LookupOverrideInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
createWithHttpInfo(params: OverridesRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Remove a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
fetch(callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Fetch a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Update a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
update(callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Update a LookupOverrideInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
update(params: OverridesRequest, headers?: any, callback?: (error: Error | null, item?: LookupOverrideInstance) => any): Promise<LookupOverrideInstance>;
/**
* Update a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Update a LookupOverrideInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
updateWithHttpInfo(params: OverridesRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<LookupOverrideInstance>) => any): Promise<ApiResponse<LookupOverrideInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
phoneNumber: string;
originalLineType: string;
overriddenLineType: string;
overrideReason: string;
overrideTimestamp: Date;
overriddenByAccountSid: string;
code: number;
message: string;
moreInfo: string;
status: number;
field: string;
limit: number;
bucket: string;
owner: string;
ttl: number;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface LookupOverrideSolution {
}
export interface LookupOverrideListInstance {
_version: V2;
_solution: LookupOverrideSolution;
_uri: string;
(field: string, phoneNumber: string): LookupOverrideContext;
get(field: string, phoneNumber: string): LookupOverrideContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function LookupOverrideListInstance(version: V2): LookupOverrideListInstance;
export {};

View File

@@ -0,0 +1,352 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Lookups
* 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.LookupOverrideInstance = exports.LookupOverrideContextImpl = exports.OverridesRequest = void 0;
exports.LookupOverrideListInstance = LookupOverrideListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class OverridesRequest {
constructor(payload) {
this.lineType = payload["line_type"];
this.reason = payload["reason"];
}
}
exports.OverridesRequest = OverridesRequest;
class LookupOverrideContextImpl {
constructor(_version, field, phoneNumber) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(field)) {
throw new Error("Parameter 'field' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(phoneNumber)) {
throw new Error("Parameter 'phoneNumber' is not valid.");
}
this._solution = { field, phoneNumber };
this._uri = `/PhoneNumbers/${phoneNumber}/Overrides/${field}`;
}
create(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new LookupOverrideInstance(operationVersion, payload, instance._solution.field, instance._solution.phoneNumber));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
createWithHttpInfo(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new LookupOverrideInstance(operationVersion, response.body, instance._solution.field, instance._solution.phoneNumber),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new LookupOverrideInstance(operationVersion, payload, instance._solution.field, instance._solution.phoneNumber));
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 LookupOverrideInstance(operationVersion, response.body, instance._solution.field, instance._solution.phoneNumber),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "put",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new LookupOverrideInstance(operationVersion, payload, instance._solution.field, instance._solution.phoneNumber));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "put",
data,
headers,
})
.then((response) => ({
...response,
body: new LookupOverrideInstance(operationVersion, response.body, instance._solution.field, instance._solution.phoneNumber),
}));
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.LookupOverrideContextImpl = LookupOverrideContextImpl;
class LookupOverrideInstance {
constructor(_version, payload, field, phoneNumber) {
this._version = _version;
this.phoneNumber = payload.phone_number;
this.originalLineType = payload.original_line_type;
this.overriddenLineType = payload.overridden_line_type;
this.overrideReason = payload.override_reason;
this.overrideTimestamp = deserialize.iso8601DateTime(payload.override_timestamp);
this.overriddenByAccountSid = payload.overridden_by_account_sid;
this.code = payload.code;
this.message = payload.message;
this.moreInfo = payload.more_info;
this.status = payload.status;
this.field = payload.field;
this.limit = payload.limit;
this.bucket = payload.bucket;
this.owner = payload.owner;
this.ttl = payload.ttl;
this._solution = {
field: field || this.field,
phoneNumber: phoneNumber || this.phoneNumber,
};
}
get _proxy() {
this._context =
this._context ||
new LookupOverrideContextImpl(this._version, this._solution.field, this._solution.phoneNumber);
return this._context;
}
create(params, callback) {
return this._proxy.create(params, callback);
}
createWithHttpInfo(params, callback) {
return this._proxy.createWithHttpInfo(params, callback);
}
/**
* Remove a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a LookupOverrideInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a LookupOverrideInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed LookupOverrideInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
phoneNumber: this.phoneNumber,
originalLineType: this.originalLineType,
overriddenLineType: this.overriddenLineType,
overrideReason: this.overrideReason,
overrideTimestamp: this.overrideTimestamp,
overriddenByAccountSid: this.overriddenByAccountSid,
code: this.code,
message: this.message,
moreInfo: this.moreInfo,
status: this.status,
field: this.field,
limit: this.limit,
bucket: this.bucket,
owner: this.owner,
ttl: this.ttl,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.LookupOverrideInstance = LookupOverrideInstance;
function LookupOverrideListInstance(version) {
const instance = ((field, phoneNumber) => instance.get(field, phoneNumber));
instance.get = function get(field, phoneNumber) {
return new LookupOverrideContextImpl(version, field, phoneNumber);
};
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;
}

View File

@@ -0,0 +1,314 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class CallForwardingInfo {
"callForwardingEnabled"?: boolean;
"errorCode"?: number;
constructor(payload: any);
}
export declare class CallerNameInfo {
"callerName"?: string;
"callerType"?: string;
"errorCode"?: number;
constructor(payload: any);
}
export declare class IdentityMatchInfo {
"firstNameMatch"?: string;
"lastNameMatch"?: string;
"addressLinesMatch"?: string;
"cityMatch"?: string;
"stateMatch"?: string;
"postalCodeMatch"?: string;
"addressCountryMatch"?: string;
"nationalIdMatch"?: string;
"dateOfBirthMatch"?: string;
"summaryScore"?: number;
"errorCode"?: number;
"errorMessage"?: string;
constructor(payload: any);
}
export declare class LastSimSwapInfo {
"lastSimSwapDate"?: Date;
"swappedPeriod"?: string;
"swappedInPeriod"?: boolean;
constructor(payload: any);
}
export declare class LineStatusInfo {
"status"?: string;
"errorCode"?: number;
constructor(payload: any);
}
export declare class LineTypeIntelligenceInfo {
"mobileCountryCode"?: string;
"mobileNetworkCode"?: string;
"carrierName"?: string;
"type"?: string;
"errorCode"?: number;
constructor(payload: any);
}
export declare class ReassignedNumberInfo {
"lastVerifiedDate"?: string;
"isNumberReassigned"?: string;
"errorCode"?: string;
constructor(payload: any);
}
export declare class SimSwapInfo {
"lastSimSwap"?: LastSimSwapInfo;
"carrierName"?: string;
"mobileCountryCode"?: string;
"mobileNetworkCode"?: string;
"errorCode"?: number;
constructor(payload: any);
}
export declare class SmsPumpingRiskInfo {
"carrierRiskCategory"?: string;
"numberBlocked"?: boolean;
"numberBlockedDate"?: Date;
"numberBlockedLast3Months"?: boolean;
"smsPumpingRiskScore"?: number;
"errorCode"?: number;
constructor(payload: any);
}
/**
* Contains reasons why a phone number is invalid. Possible values: TOO_SHORT, TOO_LONG, INVALID_BUT_POSSIBLE, INVALID_COUNTRY_CODE, INVALID_LENGTH, NOT_A_NUMBER.
*/
export type ValidationError = "TOO_SHORT" | "TOO_LONG" | "INVALID_BUT_POSSIBLE" | "INVALID_COUNTRY_CODE" | "INVALID_LENGTH" | "NOT_A_NUMBER";
/**
* Options to pass to fetch a PhoneNumberInstance
*/
export interface PhoneNumberContextFetchOptions {
/** A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score, pre_fill. */
fields?: string;
/** The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. */
countryCode?: string;
/** Users first name. This query parameter is only used (optionally) for identity_match package requests. */
firstName?: string;
/** Users last name. This query parameter is only used (optionally) for identity_match package requests. */
lastName?: string;
/** Users first address line. This query parameter is only used (optionally) for identity_match package requests. */
addressLine1?: string;
/** Users second address line. This query parameter is only used (optionally) for identity_match package requests. */
addressLine2?: string;
/** Users city. This query parameter is only used (optionally) for identity_match package requests. */
city?: string;
/** Users country subdivision, such as state, province, or locality. This query parameter is only used (optionally) for identity_match package requests. */
state?: string;
/** Users postal zip code. This query parameter is only used (optionally) for identity_match package requests. */
postalCode?: string;
/** Users country, up to two characters. This query parameter is only used (optionally) for identity_match package requests. */
addressCountryCode?: string;
/** Users national ID, such as SSN or Passport ID. This query parameter is only used (optionally) for identity_match package requests. */
nationalId?: string;
/** Users date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. */
dateOfBirth?: string;
/** The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. */
lastVerifiedDate?: string;
/** The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. */
verificationSid?: string;
/** The optional partnerSubId parameter to provide context for your sub-accounts, tenantIDs, sender IDs or other segmentation, enhancing the accuracy of the risk analysis. */
partnerSubId?: string;
}
export interface PhoneNumberContext {
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface PhoneNumberContextSolution {
phoneNumber: string;
}
export declare class PhoneNumberContextImpl implements PhoneNumberContext {
protected _version: V2;
protected _solution: PhoneNumberContextSolution;
protected _uri: string;
constructor(_version: V2, phoneNumber: string);
fetch(params?: PhoneNumberContextFetchOptions | ((error: Error | null, item?: PhoneNumberInstance) => any), callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
fetchWithHttpInfo(params?: PhoneNumberContextFetchOptions | ((error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): PhoneNumberContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface PhoneNumberResource {
calling_country_code: string;
country_code: string;
phone_number: string;
national_format: string;
valid: boolean;
validation_errors: Array<ValidationError>;
caller_name: CallerNameInfo;
sim_swap: SimSwapInfo;
call_forwarding: CallForwardingInfo;
line_type_intelligence: LineTypeIntelligenceInfo;
line_status: LineStatusInfo;
identity_match: IdentityMatchInfo;
reassigned_number: ReassignedNumberInfo;
sms_pumping_risk: SmsPumpingRiskInfo;
phone_number_quality_score: any;
pre_fill: any;
url: string;
}
export declare class PhoneNumberInstance {
protected _version: V2;
protected _solution: PhoneNumberContextSolution;
protected _context?: PhoneNumberContext;
constructor(_version: V2, payload: PhoneNumberResource, phoneNumber?: string);
/**
* International dialing prefix of the phone number defined in the E.164 standard.
*/
callingCountryCode: string;
/**
* The phone number\'s [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
*/
countryCode: string;
/**
* The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.
*/
phoneNumber: string;
/**
* The phone number in [national format](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers).
*/
nationalFormat: string;
/**
* Boolean which indicates if the phone number is in a valid range that can be freely assigned by a carrier to a user.
*/
valid: boolean;
/**
* Contains reasons why a phone number is invalid. Possible values: TOO_SHORT, TOO_LONG, INVALID_BUT_POSSIBLE, INVALID_COUNTRY_CODE, INVALID_LENGTH, NOT_A_NUMBER.
*/
validationErrors: Array<ValidationError>;
callerName: CallerNameInfo;
simSwap: SimSwapInfo;
callForwarding: CallForwardingInfo;
lineTypeIntelligence: LineTypeIntelligenceInfo;
lineStatus: LineStatusInfo;
identityMatch: IdentityMatchInfo;
reassignedNumber: ReassignedNumberInfo;
smsPumpingRisk: SmsPumpingRiskInfo;
/**
* An object that contains information of a mobile phone number quality score. Quality score will return a risk score about the phone number.
*/
phoneNumberQualityScore: any;
/**
* An object that contains pre fill information. pre_fill will return PII information associated with the phone number like first name, last name, address line, country code, state and postal code.
*/
preFill: any;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a PhoneNumberInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance
*/
fetch(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Fetch a PhoneNumberInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PhoneNumberInstance with HTTP metadata
*/
fetchWithHttpInfo(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<PhoneNumberInstance>) => any): Promise<ApiResponse<PhoneNumberInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
callingCountryCode: string;
countryCode: string;
phoneNumber: string;
nationalFormat: string;
valid: boolean;
validationErrors: ValidationError[];
callerName: CallerNameInfo;
simSwap: SimSwapInfo;
callForwarding: CallForwardingInfo;
lineTypeIntelligence: LineTypeIntelligenceInfo;
lineStatus: LineStatusInfo;
identityMatch: IdentityMatchInfo;
reassignedNumber: ReassignedNumberInfo;
smsPumpingRisk: SmsPumpingRiskInfo;
phoneNumberQualityScore: any;
preFill: any;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface PhoneNumberSolution {
}
export interface PhoneNumberListInstance {
_version: V2;
_solution: PhoneNumberSolution;
_uri: string;
(phoneNumber: string): PhoneNumberContext;
get(phoneNumber: string): PhoneNumberContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function PhoneNumberListInstance(version: V2): PhoneNumberListInstance;
export {};

347
node_modules/twilio/lib/rest/lookups/v2/phoneNumber.js generated vendored Normal file
View File

@@ -0,0 +1,347 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Lookups
* 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.PhoneNumberInstance = exports.PhoneNumberContextImpl = exports.SmsPumpingRiskInfo = exports.SimSwapInfo = exports.ReassignedNumberInfo = exports.LineTypeIntelligenceInfo = exports.LineStatusInfo = exports.LastSimSwapInfo = exports.IdentityMatchInfo = exports.CallerNameInfo = exports.CallForwardingInfo = void 0;
exports.PhoneNumberListInstance = PhoneNumberListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class CallForwardingInfo {
constructor(payload) {
this.callForwardingEnabled = payload["call_forwarding_enabled"];
this.errorCode = payload["error_code"];
}
}
exports.CallForwardingInfo = CallForwardingInfo;
class CallerNameInfo {
constructor(payload) {
this.callerName = payload["caller_name"];
this.callerType = payload["caller_type"];
this.errorCode = payload["error_code"];
}
}
exports.CallerNameInfo = CallerNameInfo;
class IdentityMatchInfo {
constructor(payload) {
this.firstNameMatch = payload["first_name_match"];
this.lastNameMatch = payload["last_name_match"];
this.addressLinesMatch = payload["address_lines_match"];
this.cityMatch = payload["city_match"];
this.stateMatch = payload["state_match"];
this.postalCodeMatch = payload["postal_code_match"];
this.addressCountryMatch = payload["address_country_match"];
this.nationalIdMatch = payload["national_id_match"];
this.dateOfBirthMatch = payload["date_of_birth_match"];
this.summaryScore = payload["summary_score"];
this.errorCode = payload["error_code"];
this.errorMessage = payload["error_message"];
}
}
exports.IdentityMatchInfo = IdentityMatchInfo;
class LastSimSwapInfo {
constructor(payload) {
this.lastSimSwapDate = payload["last_sim_swap_date"];
this.swappedPeriod = payload["swapped_period"];
this.swappedInPeriod = payload["swapped_in_period"];
}
}
exports.LastSimSwapInfo = LastSimSwapInfo;
class LineStatusInfo {
constructor(payload) {
this.status = payload["status"];
this.errorCode = payload["error_code"];
}
}
exports.LineStatusInfo = LineStatusInfo;
class LineTypeIntelligenceInfo {
constructor(payload) {
this.mobileCountryCode = payload["mobile_country_code"];
this.mobileNetworkCode = payload["mobile_network_code"];
this.carrierName = payload["carrier_name"];
this.type = payload["type"];
this.errorCode = payload["error_code"];
}
}
exports.LineTypeIntelligenceInfo = LineTypeIntelligenceInfo;
class ReassignedNumberInfo {
constructor(payload) {
this.lastVerifiedDate = payload["last_verified_date"];
this.isNumberReassigned = payload["is_number_reassigned"];
this.errorCode = payload["error_code"];
}
}
exports.ReassignedNumberInfo = ReassignedNumberInfo;
class SimSwapInfo {
constructor(payload) {
this.lastSimSwap = payload["last_sim_swap"];
this.carrierName = payload["carrier_name"];
this.mobileCountryCode = payload["mobile_country_code"];
this.mobileNetworkCode = payload["mobile_network_code"];
this.errorCode = payload["error_code"];
}
}
exports.SimSwapInfo = SimSwapInfo;
class SmsPumpingRiskInfo {
constructor(payload) {
this.carrierRiskCategory = payload["carrier_risk_category"];
this.numberBlocked = payload["number_blocked"];
this.numberBlockedDate = payload["number_blocked_date"];
this.numberBlockedLast3Months = payload["number_blocked_last_3_months"];
this.smsPumpingRiskScore = payload["sms_pumping_risk_score"];
this.errorCode = payload["error_code"];
}
}
exports.SmsPumpingRiskInfo = SmsPumpingRiskInfo;
class PhoneNumberContextImpl {
constructor(_version, phoneNumber) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(phoneNumber)) {
throw new Error("Parameter 'phoneNumber' is not valid.");
}
this._solution = { phoneNumber };
this._uri = `/PhoneNumbers/${phoneNumber}`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["fields"] !== undefined)
data["Fields"] = params["fields"];
if (params["countryCode"] !== undefined)
data["CountryCode"] = params["countryCode"];
if (params["firstName"] !== undefined)
data["FirstName"] = params["firstName"];
if (params["lastName"] !== undefined)
data["LastName"] = params["lastName"];
if (params["addressLine1"] !== undefined)
data["AddressLine1"] = params["addressLine1"];
if (params["addressLine2"] !== undefined)
data["AddressLine2"] = params["addressLine2"];
if (params["city"] !== undefined)
data["City"] = params["city"];
if (params["state"] !== undefined)
data["State"] = params["state"];
if (params["postalCode"] !== undefined)
data["PostalCode"] = params["postalCode"];
if (params["addressCountryCode"] !== undefined)
data["AddressCountryCode"] = params["addressCountryCode"];
if (params["nationalId"] !== undefined)
data["NationalId"] = params["nationalId"];
if (params["dateOfBirth"] !== undefined)
data["DateOfBirth"] = params["dateOfBirth"];
if (params["lastVerifiedDate"] !== undefined)
data["LastVerifiedDate"] = params["lastVerifiedDate"];
if (params["verificationSid"] !== undefined)
data["VerificationSid"] = params["verificationSid"];
if (params["partnerSubId"] !== undefined)
data["PartnerSubId"] = params["partnerSubId"];
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 PhoneNumberInstance(operationVersion, payload, instance._solution.phoneNumber));
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["fields"] !== undefined)
data["Fields"] = params["fields"];
if (params["countryCode"] !== undefined)
data["CountryCode"] = params["countryCode"];
if (params["firstName"] !== undefined)
data["FirstName"] = params["firstName"];
if (params["lastName"] !== undefined)
data["LastName"] = params["lastName"];
if (params["addressLine1"] !== undefined)
data["AddressLine1"] = params["addressLine1"];
if (params["addressLine2"] !== undefined)
data["AddressLine2"] = params["addressLine2"];
if (params["city"] !== undefined)
data["City"] = params["city"];
if (params["state"] !== undefined)
data["State"] = params["state"];
if (params["postalCode"] !== undefined)
data["PostalCode"] = params["postalCode"];
if (params["addressCountryCode"] !== undefined)
data["AddressCountryCode"] = params["addressCountryCode"];
if (params["nationalId"] !== undefined)
data["NationalId"] = params["nationalId"];
if (params["dateOfBirth"] !== undefined)
data["DateOfBirth"] = params["dateOfBirth"];
if (params["lastVerifiedDate"] !== undefined)
data["LastVerifiedDate"] = params["lastVerifiedDate"];
if (params["verificationSid"] !== undefined)
data["VerificationSid"] = params["verificationSid"];
if (params["partnerSubId"] !== undefined)
data["PartnerSubId"] = params["partnerSubId"];
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 PhoneNumberInstance(operationVersion, response.body, instance._solution.phoneNumber),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberContextImpl = PhoneNumberContextImpl;
class PhoneNumberInstance {
constructor(_version, payload, phoneNumber) {
this._version = _version;
this.callingCountryCode = payload.calling_country_code;
this.countryCode = payload.country_code;
this.phoneNumber = payload.phone_number;
this.nationalFormat = payload.national_format;
this.valid = payload.valid;
this.validationErrors = payload.validation_errors;
this.callerName =
payload.caller_name !== null && payload.caller_name !== undefined
? new CallerNameInfo(payload.caller_name)
: null;
this.simSwap =
payload.sim_swap !== null && payload.sim_swap !== undefined
? new SimSwapInfo(payload.sim_swap)
: null;
this.callForwarding =
payload.call_forwarding !== null && payload.call_forwarding !== undefined
? new CallForwardingInfo(payload.call_forwarding)
: null;
this.lineTypeIntelligence =
payload.line_type_intelligence !== null &&
payload.line_type_intelligence !== undefined
? new LineTypeIntelligenceInfo(payload.line_type_intelligence)
: null;
this.lineStatus =
payload.line_status !== null && payload.line_status !== undefined
? new LineStatusInfo(payload.line_status)
: null;
this.identityMatch =
payload.identity_match !== null && payload.identity_match !== undefined
? new IdentityMatchInfo(payload.identity_match)
: null;
this.reassignedNumber =
payload.reassigned_number !== null &&
payload.reassigned_number !== undefined
? new ReassignedNumberInfo(payload.reassigned_number)
: null;
this.smsPumpingRisk =
payload.sms_pumping_risk !== null &&
payload.sms_pumping_risk !== undefined
? new SmsPumpingRiskInfo(payload.sms_pumping_risk)
: null;
this.phoneNumberQualityScore = payload.phone_number_quality_score;
this.preFill = payload.pre_fill;
this.url = payload.url;
this._solution = { phoneNumber: phoneNumber || this.phoneNumber };
}
get _proxy() {
this._context =
this._context ||
new PhoneNumberContextImpl(this._version, this._solution.phoneNumber);
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 {
callingCountryCode: this.callingCountryCode,
countryCode: this.countryCode,
phoneNumber: this.phoneNumber,
nationalFormat: this.nationalFormat,
valid: this.valid,
validationErrors: this.validationErrors,
callerName: this.callerName,
simSwap: this.simSwap,
callForwarding: this.callForwarding,
lineTypeIntelligence: this.lineTypeIntelligence,
lineStatus: this.lineStatus,
identityMatch: this.identityMatch,
reassignedNumber: this.reassignedNumber,
smsPumpingRisk: this.smsPumpingRisk,
phoneNumberQualityScore: this.phoneNumberQualityScore,
preFill: this.preFill,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PhoneNumberInstance = PhoneNumberInstance;
function PhoneNumberListInstance(version) {
const instance = ((phoneNumber) => instance.get(phoneNumber));
instance.get = function get(phoneNumber) {
return new PhoneNumberContextImpl(version, phoneNumber);
};
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;
}

210
node_modules/twilio/lib/rest/lookups/v2/query.d.ts generated vendored Normal file
View File

@@ -0,0 +1,210 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class CallForwardingInfo {
"callForwardingEnabled"?: boolean;
"errorCode"?: number;
constructor(payload: any);
}
export declare class CallerNameInfo {
"callerName"?: string;
"callerType"?: string;
"errorCode"?: number;
constructor(payload: any);
}
export declare class IdentityMatchInfo {
"firstNameMatch"?: string;
"lastNameMatch"?: string;
"addressLinesMatch"?: string;
"cityMatch"?: string;
"stateMatch"?: string;
"postalCodeMatch"?: string;
"addressCountryMatch"?: string;
"nationalIdMatch"?: string;
"dateOfBirthMatch"?: string;
"summaryScore"?: number;
"errorCode"?: number;
"errorMessage"?: string;
constructor(payload: any);
}
export declare class IdentityMatchParameters {
"firstName"?: string;
"lastName"?: string;
"addressLine1"?: string;
"addressLine2"?: string;
"city"?: string;
"state"?: string;
"postalCode"?: string;
"addressCountryCode"?: string;
"nationalId"?: string;
"dateOfBirth"?: string;
constructor(payload: any);
}
export declare class LastSimSwapInfo {
"lastSimSwapDate"?: Date;
"swappedPeriod"?: string;
"swappedInPeriod"?: boolean;
constructor(payload: any);
}
export declare class LineStatusInfo {
"status"?: string;
"errorCode"?: number;
constructor(payload: any);
}
export declare class LineTypeIntelligenceInfo {
"mobileCountryCode"?: string;
"mobileNetworkCode"?: string;
"carrierName"?: string;
"type"?: string;
"errorCode"?: number;
constructor(payload: any);
}
export declare class LookupBatchRequest {
/**
* Unique identifier used to match request with response
*/
"correlationId"?: string;
"phoneNumber": string;
"fields"?: Array<string>;
"countryCode"?: string;
"identityMatch"?: IdentityMatchParameters;
"reassignedNumber"?: ReassignedNumberParameters;
"smsPumpingRisk"?: RiskParameters;
constructor(payload: any);
}
export declare class LookupBatchResponse {
/**
* Unique identifier used to match request with response
*/
"correlationId"?: string;
/**
* Twilio error code in case that the request to downstream fails
*/
"twilioErrorCode"?: number;
"callingCountryCode"?: string;
"countryCode"?: string;
"phoneNumber"?: string;
"nationalFormat"?: string;
"valid"?: boolean;
"validationErrors"?: Array<string>;
"callerName"?: CallerNameInfo;
"simSwap"?: SimSwapInfo;
"callForwarding"?: CallForwardingInfo;
"lineTypeIntelligence"?: LineTypeIntelligenceInfo;
"lineStatus"?: LineStatusInfo;
"identityMatch"?: IdentityMatchInfo;
"reassignedNumber"?: ReassignedNumberInfo;
"smsPumpingRisk"?: SmsPumpingRiskInfo;
"phoneNumberQualityScore"?: any | null;
"preFill"?: any | null;
constructor(payload: any);
}
export declare class LookupRequest {
"phoneNumbers"?: Array<LookupBatchRequest>;
constructor(payload: any);
}
export declare class ReassignedNumberInfo {
"lastVerifiedDate"?: string;
"isNumberReassigned"?: string;
"errorCode"?: string;
constructor(payload: any);
}
export declare class ReassignedNumberParameters {
"lastVerifiedDate"?: string;
constructor(payload: any);
}
export declare class RiskParameters {
"partnerSubId"?: string;
constructor(payload: any);
}
export declare class SimSwapInfo {
"lastSimSwap"?: LastSimSwapInfo;
"carrierName"?: string;
"mobileCountryCode"?: string;
"mobileNetworkCode"?: string;
"errorCode"?: number;
constructor(payload: any);
}
export declare class SmsPumpingRiskInfo {
"carrierRiskCategory"?: string;
"numberBlocked"?: boolean;
"numberBlockedDate"?: Date;
"numberBlockedLast3Months"?: boolean;
"smsPumpingRiskScore"?: number;
"errorCode"?: number;
constructor(payload: any);
}
/**
* Options to pass to create a QueryInstance
*/
export interface QueryListInstanceCreateOptions {
/** */
lookupRequest?: LookupRequest;
}
export interface QuerySolution {
}
export interface QueryListInstance {
_version: V2;
_solution: QuerySolution;
_uri: string;
/**
* Create a QueryInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed QueryInstance
*/
create(callback?: (error: Error | null, item?: QueryInstance) => any): Promise<QueryInstance>;
/**
* Create a QueryInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed QueryInstance
*/
create(params: LookupRequest, headers?: any, callback?: (error: Error | null, item?: QueryInstance) => any): Promise<QueryInstance>;
/**
* Create a QueryInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed QueryInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<QueryInstance>) => any): Promise<ApiResponse<QueryInstance>>;
/**
* Create a QueryInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed QueryInstance with HTTP metadata
*/
createWithHttpInfo(params: LookupRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<QueryInstance>) => any): Promise<ApiResponse<QueryInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function QueryListInstance(version: V2): QueryListInstance;
interface QueryResource {
phone_numbers: Array<LookupBatchResponse>;
}
export declare class QueryInstance {
protected _version: V2;
constructor(_version: V2, payload: QueryResource);
phoneNumbers: Array<LookupBatchResponse>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
phoneNumbers: LookupBatchResponse[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

266
node_modules/twilio/lib/rest/lookups/v2/query.js generated vendored Normal file
View File

@@ -0,0 +1,266 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Lookups
* 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.QueryInstance = exports.SmsPumpingRiskInfo = exports.SimSwapInfo = exports.RiskParameters = exports.ReassignedNumberParameters = exports.ReassignedNumberInfo = exports.LookupRequest = exports.LookupBatchResponse = exports.LookupBatchRequest = exports.LineTypeIntelligenceInfo = exports.LineStatusInfo = exports.LastSimSwapInfo = exports.IdentityMatchParameters = exports.IdentityMatchInfo = exports.CallerNameInfo = exports.CallForwardingInfo = void 0;
exports.QueryListInstance = QueryListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
class CallForwardingInfo {
constructor(payload) {
this.callForwardingEnabled = payload["call_forwarding_enabled"];
this.errorCode = payload["error_code"];
}
}
exports.CallForwardingInfo = CallForwardingInfo;
class CallerNameInfo {
constructor(payload) {
this.callerName = payload["caller_name"];
this.callerType = payload["caller_type"];
this.errorCode = payload["error_code"];
}
}
exports.CallerNameInfo = CallerNameInfo;
class IdentityMatchInfo {
constructor(payload) {
this.firstNameMatch = payload["first_name_match"];
this.lastNameMatch = payload["last_name_match"];
this.addressLinesMatch = payload["address_lines_match"];
this.cityMatch = payload["city_match"];
this.stateMatch = payload["state_match"];
this.postalCodeMatch = payload["postal_code_match"];
this.addressCountryMatch = payload["address_country_match"];
this.nationalIdMatch = payload["national_id_match"];
this.dateOfBirthMatch = payload["date_of_birth_match"];
this.summaryScore = payload["summary_score"];
this.errorCode = payload["error_code"];
this.errorMessage = payload["error_message"];
}
}
exports.IdentityMatchInfo = IdentityMatchInfo;
class IdentityMatchParameters {
constructor(payload) {
this.firstName = payload["first_name"];
this.lastName = payload["last_name"];
this.addressLine1 = payload["address_line1"];
this.addressLine2 = payload["address_line2"];
this.city = payload["city"];
this.state = payload["state"];
this.postalCode = payload["postal_code"];
this.addressCountryCode = payload["address_country_code"];
this.nationalId = payload["national_id"];
this.dateOfBirth = payload["date_of_birth"];
}
}
exports.IdentityMatchParameters = IdentityMatchParameters;
class LastSimSwapInfo {
constructor(payload) {
this.lastSimSwapDate = payload["last_sim_swap_date"];
this.swappedPeriod = payload["swapped_period"];
this.swappedInPeriod = payload["swapped_in_period"];
}
}
exports.LastSimSwapInfo = LastSimSwapInfo;
class LineStatusInfo {
constructor(payload) {
this.status = payload["status"];
this.errorCode = payload["error_code"];
}
}
exports.LineStatusInfo = LineStatusInfo;
class LineTypeIntelligenceInfo {
constructor(payload) {
this.mobileCountryCode = payload["mobile_country_code"];
this.mobileNetworkCode = payload["mobile_network_code"];
this.carrierName = payload["carrier_name"];
this.type = payload["type"];
this.errorCode = payload["error_code"];
}
}
exports.LineTypeIntelligenceInfo = LineTypeIntelligenceInfo;
class LookupBatchRequest {
constructor(payload) {
this.correlationId = payload["correlation_id"];
this.phoneNumber = payload["phone_number"];
this.fields = payload["fields"];
this.countryCode = payload["country_code"];
this.identityMatch = payload["identity_match"];
this.reassignedNumber = payload["reassigned_number"];
this.smsPumpingRisk = payload["sms_pumping_risk"];
}
}
exports.LookupBatchRequest = LookupBatchRequest;
class LookupBatchResponse {
constructor(payload) {
this.correlationId = payload["correlation_id"];
this.twilioErrorCode = payload["twilio_error_code"];
this.callingCountryCode = payload["calling_country_code"];
this.countryCode = payload["country_code"];
this.phoneNumber = payload["phone_number"];
this.nationalFormat = payload["national_format"];
this.valid = payload["valid"];
this.validationErrors = payload["validation_errors"];
this.callerName = payload["caller_name"];
this.simSwap = payload["sim_swap"];
this.callForwarding = payload["call_forwarding"];
this.lineTypeIntelligence = payload["line_type_intelligence"];
this.lineStatus = payload["line_status"];
this.identityMatch = payload["identity_match"];
this.reassignedNumber = payload["reassigned_number"];
this.smsPumpingRisk = payload["sms_pumping_risk"];
this.phoneNumberQualityScore = payload["phone_number_quality_score"];
this.preFill = payload["pre_fill"];
}
}
exports.LookupBatchResponse = LookupBatchResponse;
class LookupRequest {
constructor(payload) {
this.phoneNumbers = payload["phone_numbers"];
}
}
exports.LookupRequest = LookupRequest;
class ReassignedNumberInfo {
constructor(payload) {
this.lastVerifiedDate = payload["last_verified_date"];
this.isNumberReassigned = payload["is_number_reassigned"];
this.errorCode = payload["error_code"];
}
}
exports.ReassignedNumberInfo = ReassignedNumberInfo;
class ReassignedNumberParameters {
constructor(payload) {
this.lastVerifiedDate = payload["last_verified_date"];
}
}
exports.ReassignedNumberParameters = ReassignedNumberParameters;
class RiskParameters {
constructor(payload) {
this.partnerSubId = payload["partner_sub_id"];
}
}
exports.RiskParameters = RiskParameters;
class SimSwapInfo {
constructor(payload) {
this.lastSimSwap = payload["last_sim_swap"];
this.carrierName = payload["carrier_name"];
this.mobileCountryCode = payload["mobile_country_code"];
this.mobileNetworkCode = payload["mobile_network_code"];
this.errorCode = payload["error_code"];
}
}
exports.SimSwapInfo = SimSwapInfo;
class SmsPumpingRiskInfo {
constructor(payload) {
this.carrierRiskCategory = payload["carrier_risk_category"];
this.numberBlocked = payload["number_blocked"];
this.numberBlockedDate = payload["number_blocked_date"];
this.numberBlockedLast3Months = payload["number_blocked_last_3_months"];
this.smsPumpingRiskScore = payload["sms_pumping_risk_score"];
this.errorCode = payload["error_code"];
}
}
exports.SmsPumpingRiskInfo = SmsPumpingRiskInfo;
function QueryListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/batch/query`;
instance.create = function create(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new QueryInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new QueryInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
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 QueryInstance {
constructor(_version, payload) {
this._version = _version;
this.phoneNumbers =
payload.phone_numbers !== null && payload.phone_numbers !== undefined
? payload.phone_numbers.map((payload) => new LookupBatchResponse(payload))
: null;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
phoneNumbers: this.phoneNumbers,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.QueryInstance = QueryInstance;

101
node_modules/twilio/lib/rest/lookups/v2/rateLimit.d.ts generated vendored Normal file
View File

@@ -0,0 +1,101 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Rate limit response schema
*/
export declare class RateLimitResponse {
/**
* Limit of requests for the bucket
*/
"field"?: string;
/**
* Limit of requests for the bucket
*/
"limit"?: number;
/**
* Name of the bucket
*/
"bucket"?: string;
/**
* Owner of the rule
*/
"owner"?: string;
/**
* Time to live of the rule
*/
"ttl"?: number;
constructor(payload: any);
}
/**
* Options to pass to fetch a RateLimitInstance
*/
export interface RateLimitListInstanceFetchOptions {
/** */
fields?: Array<string>;
}
export interface RateLimitSolution {
}
export interface RateLimitListInstance {
_version: V2;
_solution: RateLimitSolution;
_uri: string;
/**
* Fetch a RateLimitInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RateLimitInstance
*/
fetch(callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>;
/**
* Fetch a RateLimitInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RateLimitInstance
*/
fetch(params: RateLimitListInstanceFetchOptions, callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>;
/**
* Fetch a RateLimitInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RateLimitInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RateLimitInstance>) => any): Promise<ApiResponse<RateLimitInstance>>;
/**
* Fetch a RateLimitInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RateLimitInstance with HTTP metadata
*/
fetchWithHttpInfo(params: RateLimitListInstanceFetchOptions, callback?: (error: Error | null, item?: ApiResponse<RateLimitInstance>) => any): Promise<ApiResponse<RateLimitInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function RateLimitListInstance(version: V2): RateLimitListInstance;
interface RateLimitResource {
rate_limits: Array<RateLimitResponse>;
}
export declare class RateLimitInstance {
protected _version: V2;
constructor(_version: V2, payload: RateLimitResource);
rateLimits: Array<RateLimitResponse>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
rateLimits: RateLimitResponse[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

121
node_modules/twilio/lib/rest/lookups/v2/rateLimit.js generated vendored Normal file
View File

@@ -0,0 +1,121 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Lookups
* 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.RateLimitInstance = exports.RateLimitResponse = void 0;
exports.RateLimitListInstance = RateLimitListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
/**
* Rate limit response schema
*/
class RateLimitResponse {
constructor(payload) {
this.field = payload["field"];
this.limit = payload["limit"];
this.bucket = payload["bucket"];
this.owner = payload["owner"];
this.ttl = payload["ttl"];
}
}
exports.RateLimitResponse = RateLimitResponse;
function RateLimitListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/RateLimits`;
instance.fetch = function fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["fields"] !== undefined)
data["Fields"] = serialize.map(params["fields"], (e) => e);
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new RateLimitInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.fetchWithHttpInfo = function fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["fields"] !== undefined)
data["Fields"] = serialize.map(params["fields"], (e) => e);
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
params: data,
headers,
})
.then((response) => ({
...response,
body: new RateLimitInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
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 RateLimitInstance {
constructor(_version, payload) {
this._version = _version;
this.rateLimits =
payload.rate_limits !== null && payload.rate_limits !== undefined
? payload.rate_limits.map((payload) => new RateLimitResponse(payload))
: null;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
rateLimits: this.rateLimits,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RateLimitInstance = RateLimitInstance;