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

View File

@@ -0,0 +1,20 @@
import PreviewBase from "../PreviewBase";
import Version from "../../base/Version";
import { AuthorizationDocumentListInstance } from "./hosted_numbers/authorizationDocument";
import { HostedNumberOrderListInstance } from "./hosted_numbers/hostedNumberOrder";
export default class HostedNumbers extends Version {
/**
* Initialize the HostedNumbers version of Preview
*
* @param domain - The Twilio (Twilio.Preview) domain
*/
constructor(domain: PreviewBase);
/** authorizationDocuments - { Twilio.Preview.HostedNumbers.AuthorizationDocumentListInstance } resource */
protected _authorizationDocuments?: AuthorizationDocumentListInstance;
/** hostedNumberOrders - { Twilio.Preview.HostedNumbers.HostedNumberOrderListInstance } resource */
protected _hostedNumberOrders?: HostedNumberOrderListInstance;
/** Getter for authorizationDocuments resource */
get authorizationDocuments(): AuthorizationDocumentListInstance;
/** Getter for hostedNumberOrders resource */
get hostedNumberOrders(): HostedNumberOrderListInstance;
}

44
node_modules/twilio/lib/rest/preview/HostedNumbers.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* 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 authorizationDocument_1 = require("./hosted_numbers/authorizationDocument");
const hostedNumberOrder_1 = require("./hosted_numbers/hostedNumberOrder");
class HostedNumbers extends Version_1.default {
/**
* Initialize the HostedNumbers version of Preview
*
* @param domain - The Twilio (Twilio.Preview) domain
*/
constructor(domain) {
super(domain, "HostedNumbers");
}
/** Getter for authorizationDocuments resource */
get authorizationDocuments() {
this._authorizationDocuments =
this._authorizationDocuments || (0, authorizationDocument_1.AuthorizationDocumentListInstance)(this);
return this._authorizationDocuments;
}
/** Getter for hostedNumberOrders resource */
get hostedNumberOrders() {
this._hostedNumberOrders =
this._hostedNumberOrders || (0, hostedNumberOrder_1.HostedNumberOrderListInstance)(this);
return this._hostedNumberOrders;
}
}
exports.default = HostedNumbers;

20
node_modules/twilio/lib/rest/preview/Marketplace.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import PreviewBase from "../PreviewBase";
import Version from "../../base/Version";
import { AvailableAddOnListInstance } from "./marketplace/availableAddOn";
import { InstalledAddOnListInstance } from "./marketplace/installedAddOn";
export default class Marketplace extends Version {
/**
* Initialize the Marketplace version of Preview
*
* @param domain - The Twilio (Twilio.Preview) domain
*/
constructor(domain: PreviewBase);
/** availableAddOns - { Twilio.Preview.Marketplace.AvailableAddOnListInstance } resource */
protected _availableAddOns?: AvailableAddOnListInstance;
/** installedAddOns - { Twilio.Preview.Marketplace.InstalledAddOnListInstance } resource */
protected _installedAddOns?: InstalledAddOnListInstance;
/** Getter for availableAddOns resource */
get availableAddOns(): AvailableAddOnListInstance;
/** Getter for installedAddOns resource */
get installedAddOns(): InstalledAddOnListInstance;
}

44
node_modules/twilio/lib/rest/preview/Marketplace.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* 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 availableAddOn_1 = require("./marketplace/availableAddOn");
const installedAddOn_1 = require("./marketplace/installedAddOn");
class Marketplace extends Version_1.default {
/**
* Initialize the Marketplace version of Preview
*
* @param domain - The Twilio (Twilio.Preview) domain
*/
constructor(domain) {
super(domain, "marketplace");
}
/** Getter for availableAddOns resource */
get availableAddOns() {
this._availableAddOns =
this._availableAddOns || (0, availableAddOn_1.AvailableAddOnListInstance)(this);
return this._availableAddOns;
}
/** Getter for installedAddOns resource */
get installedAddOns() {
this._installedAddOns =
this._installedAddOns || (0, installedAddOn_1.InstalledAddOnListInstance)(this);
return this._installedAddOns;
}
}
exports.default = Marketplace;

25
node_modules/twilio/lib/rest/preview/Wireless.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import PreviewBase from "../PreviewBase";
import Version from "../../base/Version";
import { CommandListInstance } from "./wireless/command";
import { RatePlanListInstance } from "./wireless/ratePlan";
import { SimListInstance } from "./wireless/sim";
export default class Wireless extends Version {
/**
* Initialize the Wireless version of Preview
*
* @param domain - The Twilio (Twilio.Preview) domain
*/
constructor(domain: PreviewBase);
/** commands - { Twilio.Preview.Wireless.CommandListInstance } resource */
protected _commands?: CommandListInstance;
/** ratePlans - { Twilio.Preview.Wireless.RatePlanListInstance } resource */
protected _ratePlans?: RatePlanListInstance;
/** sims - { Twilio.Preview.Wireless.SimListInstance } resource */
protected _sims?: SimListInstance;
/** Getter for commands resource */
get commands(): CommandListInstance;
/** Getter for ratePlans resource */
get ratePlans(): RatePlanListInstance;
/** Getter for sims resource */
get sims(): SimListInstance;
}

48
node_modules/twilio/lib/rest/preview/Wireless.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* 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 command_1 = require("./wireless/command");
const ratePlan_1 = require("./wireless/ratePlan");
const sim_1 = require("./wireless/sim");
class Wireless extends Version_1.default {
/**
* Initialize the Wireless version of Preview
*
* @param domain - The Twilio (Twilio.Preview) domain
*/
constructor(domain) {
super(domain, "wireless");
}
/** Getter for commands resource */
get commands() {
this._commands = this._commands || (0, command_1.CommandListInstance)(this);
return this._commands;
}
/** Getter for ratePlans resource */
get ratePlans() {
this._ratePlans = this._ratePlans || (0, ratePlan_1.RatePlanListInstance)(this);
return this._ratePlans;
}
/** Getter for sims resource */
get sims() {
this._sims = this._sims || (0, sim_1.SimListInstance)(this);
return this._sims;
}
}
exports.default = Wireless;

View File

@@ -0,0 +1,443 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import HostedNumbers from "../HostedNumbers";
import { ApiResponse } from "../../../base/ApiResponse";
import { DependentHostedNumberOrderListInstance } from "./authorizationDocument/dependentHostedNumberOrder";
/**
* Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
*/
export type AuthorizationDocumentStatus = "opened" | "signing" | "signed" | "canceled" | "failed";
/**
* Options to pass to update a AuthorizationDocumentInstance
*/
export interface AuthorizationDocumentContextUpdateOptions {
/** A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio\\\'s platform. */
hostedNumberOrderSids?: Array<string>;
/** A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. */
addressSid?: string;
/** Email that this AuthorizationDocument will be sent to for signing. */
email?: string;
/** Email recipients who will be informed when an Authorization Document has been sent and signed */
ccEmails?: Array<string>;
/** */
status?: AuthorizationDocumentStatus;
/** The title of the person authorized to sign the Authorization Document for this phone number. */
contactTitle?: string;
/** The contact phone number of the person authorized to sign the Authorization Document. */
contactPhoneNumber?: string;
}
/**
* Options to pass to create a AuthorizationDocumentInstance
*/
export interface AuthorizationDocumentListInstanceCreateOptions {
/** A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio\\\'s platform. */
hostedNumberOrderSids: Array<string>;
/** A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. */
addressSid: string;
/** Email that this AuthorizationDocument will be sent to for signing. */
email: string;
/** The title of the person authorized to sign the Authorization Document for this phone number. */
contactTitle: string;
/** The contact phone number of the person authorized to sign the Authorization Document. */
contactPhoneNumber: string;
/** Email recipients who will be informed when an Authorization Document has been sent and signed. */
ccEmails?: Array<string>;
}
/**
* Options to pass to each
*/
export interface AuthorizationDocumentListInstanceEachOptions {
/** Email that this AuthorizationDocument will be sent to for signing. */
email?: string;
/** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */
status?: AuthorizationDocumentStatus;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface AuthorizationDocumentListInstanceOptions {
/** Email that this AuthorizationDocument will be sent to for signing. */
email?: string;
/** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */
status?: AuthorizationDocumentStatus;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface AuthorizationDocumentListInstancePageOptions {
/** Email that this AuthorizationDocument will be sent to for signing. */
email?: string;
/** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */
status?: AuthorizationDocumentStatus;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface AuthorizationDocumentContext {
dependentHostedNumberOrders: DependentHostedNumberOrderListInstance;
/**
* Fetch a AuthorizationDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance
*/
fetch(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>;
/**
* Fetch a AuthorizationDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any): Promise<ApiResponse<AuthorizationDocumentInstance>>;
/**
* Update a AuthorizationDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance
*/
update(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>;
/**
* Update a AuthorizationDocumentInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance
*/
update(params: AuthorizationDocumentContextUpdateOptions, callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>;
/**
* Update a AuthorizationDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any): Promise<ApiResponse<AuthorizationDocumentInstance>>;
/**
* Update a AuthorizationDocumentInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance with HTTP metadata
*/
updateWithHttpInfo(params: AuthorizationDocumentContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any): Promise<ApiResponse<AuthorizationDocumentInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface AuthorizationDocumentContextSolution {
sid: string;
}
export declare class AuthorizationDocumentContextImpl implements AuthorizationDocumentContext {
protected _version: HostedNumbers;
protected _solution: AuthorizationDocumentContextSolution;
protected _uri: string;
protected _dependentHostedNumberOrders?: DependentHostedNumberOrderListInstance;
constructor(_version: HostedNumbers, sid: string);
get dependentHostedNumberOrders(): DependentHostedNumberOrderListInstance;
fetch(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any): Promise<ApiResponse<AuthorizationDocumentInstance>>;
update(params?: AuthorizationDocumentContextUpdateOptions | ((error: Error | null, item?: AuthorizationDocumentInstance) => any), callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>;
updateWithHttpInfo(params?: AuthorizationDocumentContextUpdateOptions | ((error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any): Promise<ApiResponse<AuthorizationDocumentInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): AuthorizationDocumentContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AuthorizationDocumentPayload extends TwilioResponsePayload {
items: AuthorizationDocumentResource[];
}
interface AuthorizationDocumentResource {
sid: string;
address_sid: string;
status: AuthorizationDocumentStatus;
email: string;
cc_emails: Array<string>;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class AuthorizationDocumentInstance {
protected _version: HostedNumbers;
protected _solution: AuthorizationDocumentContextSolution;
protected _context?: AuthorizationDocumentContext;
constructor(_version: HostedNumbers, payload: AuthorizationDocumentResource, sid?: string);
/**
* A 34 character string that uniquely identifies this AuthorizationDocument.
*/
sid: string;
/**
* A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument.
*/
addressSid: string;
status: AuthorizationDocumentStatus;
/**
* Email that this AuthorizationDocument will be sent to for signing.
*/
email: string;
/**
* Email recipients who will be informed when an Authorization Document has been sent and signed.
*/
ccEmails: Array<string>;
/**
* The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
url: string;
links: Record<string, string>;
private get _proxy();
/**
* Fetch a AuthorizationDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance
*/
fetch(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>;
/**
* Fetch a AuthorizationDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any): Promise<ApiResponse<AuthorizationDocumentInstance>>;
/**
* Update a AuthorizationDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance
*/
update(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>;
/**
* Update a AuthorizationDocumentInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance
*/
update(params: AuthorizationDocumentContextUpdateOptions, callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>;
/**
* Update a AuthorizationDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any): Promise<ApiResponse<AuthorizationDocumentInstance>>;
/**
* Update a AuthorizationDocumentInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance with HTTP metadata
*/
updateWithHttpInfo(params: AuthorizationDocumentContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any): Promise<ApiResponse<AuthorizationDocumentInstance>>;
/**
* Access the dependentHostedNumberOrders.
*/
dependentHostedNumberOrders(): DependentHostedNumberOrderListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
addressSid: string;
status: AuthorizationDocumentStatus;
email: string;
ccEmails: string[];
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AuthorizationDocumentSolution {
}
export interface AuthorizationDocumentListInstance {
_version: HostedNumbers;
_solution: AuthorizationDocumentSolution;
_uri: string;
(sid: string): AuthorizationDocumentContext;
get(sid: string): AuthorizationDocumentContext;
/**
* Create a AuthorizationDocumentInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance
*/
create(params: AuthorizationDocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>;
/**
* Create a AuthorizationDocumentInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance with HTTP metadata
*/
createWithHttpInfo(params: AuthorizationDocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<AuthorizationDocumentInstance>) => any): Promise<ApiResponse<AuthorizationDocumentInstance>>;
/**
* Streams AuthorizationDocumentInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AuthorizationDocumentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void): void;
each(params: AuthorizationDocumentListInstanceEachOptions, callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void): void;
/**
* Streams AuthorizationDocumentInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AuthorizationDocumentListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: AuthorizationDocumentListInstanceEachOptions, callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of AuthorizationDocumentInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: AuthorizationDocumentPage) => any): Promise<AuthorizationDocumentPage>;
/**
* Retrieve a single target page of AuthorizationDocumentInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<AuthorizationDocumentPage>) => any): Promise<ApiResponse<AuthorizationDocumentPage>>;
/**
* Lists AuthorizationDocumentInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AuthorizationDocumentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: AuthorizationDocumentInstance[]) => any): Promise<AuthorizationDocumentInstance[]>;
list(params: AuthorizationDocumentListInstanceOptions, callback?: (error: Error | null, items: AuthorizationDocumentInstance[]) => any): Promise<AuthorizationDocumentInstance[]>;
/**
* Lists AuthorizationDocumentInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AuthorizationDocumentListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AuthorizationDocumentInstance[]>) => any): Promise<ApiResponse<AuthorizationDocumentInstance[]>>;
listWithHttpInfo(params: AuthorizationDocumentListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AuthorizationDocumentInstance[]>) => any): Promise<ApiResponse<AuthorizationDocumentInstance[]>>;
/**
* Retrieve a single page of AuthorizationDocumentInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AuthorizationDocumentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: AuthorizationDocumentPage) => any): Promise<AuthorizationDocumentPage>;
page(params: AuthorizationDocumentListInstancePageOptions, callback?: (error: Error | null, items: AuthorizationDocumentPage) => any): Promise<AuthorizationDocumentPage>;
/**
* Retrieve a single page of AuthorizationDocumentInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AuthorizationDocumentListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AuthorizationDocumentPage>) => any): Promise<ApiResponse<AuthorizationDocumentPage>>;
pageWithHttpInfo(params: AuthorizationDocumentListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AuthorizationDocumentPage>) => any): Promise<ApiResponse<AuthorizationDocumentPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AuthorizationDocumentListInstance(version: HostedNumbers): AuthorizationDocumentListInstance;
export declare class AuthorizationDocumentPage extends Page<HostedNumbers, AuthorizationDocumentPayload, AuthorizationDocumentResource, AuthorizationDocumentInstance> {
/**
* Initialize the AuthorizationDocumentPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: HostedNumbers, response: Response<string>, solution: AuthorizationDocumentSolution);
/**
* Build an instance of AuthorizationDocumentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: AuthorizationDocumentResource): AuthorizationDocumentInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,467 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthorizationDocumentPage = exports.AuthorizationDocumentInstance = exports.AuthorizationDocumentContextImpl = void 0;
exports.AuthorizationDocumentListInstance = AuthorizationDocumentListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const dependentHostedNumberOrder_1 = require("./authorizationDocument/dependentHostedNumberOrder");
class AuthorizationDocumentContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/AuthorizationDocuments/${sid}`;
}
get dependentHostedNumberOrders() {
this._dependentHostedNumberOrders =
this._dependentHostedNumberOrders ||
(0, dependentHostedNumberOrder_1.DependentHostedNumberOrderListInstance)(this._version, this._solution.sid);
return this._dependentHostedNumberOrders;
}
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 AuthorizationDocumentInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new AuthorizationDocumentInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["hostedNumberOrderSids"] !== undefined)
data["HostedNumberOrderSids"] = serialize.map(params["hostedNumberOrderSids"], (e) => e);
if (params["addressSid"] !== undefined)
data["AddressSid"] = params["addressSid"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
if (params["ccEmails"] !== undefined)
data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e);
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["contactTitle"] !== undefined)
data["ContactTitle"] = params["contactTitle"];
if (params["contactPhoneNumber"] !== undefined)
data["ContactPhoneNumber"] = params["contactPhoneNumber"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new AuthorizationDocumentInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["hostedNumberOrderSids"] !== undefined)
data["HostedNumberOrderSids"] = serialize.map(params["hostedNumberOrderSids"], (e) => e);
if (params["addressSid"] !== undefined)
data["AddressSid"] = params["addressSid"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
if (params["ccEmails"] !== undefined)
data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e);
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["contactTitle"] !== undefined)
data["ContactTitle"] = params["contactTitle"];
if (params["contactPhoneNumber"] !== undefined)
data["ContactPhoneNumber"] = params["contactPhoneNumber"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new AuthorizationDocumentInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AuthorizationDocumentContextImpl = AuthorizationDocumentContextImpl;
class AuthorizationDocumentInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.addressSid = payload.address_sid;
this.status = payload.status;
this.email = payload.email;
this.ccEmails = payload.cc_emails;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new AuthorizationDocumentContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a AuthorizationDocumentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a AuthorizationDocumentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthorizationDocumentInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the dependentHostedNumberOrders.
*/
dependentHostedNumberOrders() {
return this._proxy.dependentHostedNumberOrders;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
addressSid: this.addressSid,
status: this.status,
email: this.email,
ccEmails: this.ccEmails,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AuthorizationDocumentInstance = AuthorizationDocumentInstance;
function AuthorizationDocumentListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new AuthorizationDocumentContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/AuthorizationDocuments`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["hostedNumberOrderSids"] === null ||
params["hostedNumberOrderSids"] === undefined) {
throw new Error("Required parameter \"params['hostedNumberOrderSids']\" missing.");
}
if (params["addressSid"] === null || params["addressSid"] === undefined) {
throw new Error("Required parameter \"params['addressSid']\" missing.");
}
if (params["email"] === null || params["email"] === undefined) {
throw new Error("Required parameter \"params['email']\" missing.");
}
if (params["contactTitle"] === null ||
params["contactTitle"] === undefined) {
throw new Error("Required parameter \"params['contactTitle']\" missing.");
}
if (params["contactPhoneNumber"] === null ||
params["contactPhoneNumber"] === undefined) {
throw new Error("Required parameter \"params['contactPhoneNumber']\" missing.");
}
let data = {};
data["HostedNumberOrderSids"] = serialize.map(params["hostedNumberOrderSids"], (e) => e);
data["AddressSid"] = params["addressSid"];
data["Email"] = params["email"];
data["ContactTitle"] = params["contactTitle"];
data["ContactPhoneNumber"] = params["contactPhoneNumber"];
if (params["ccEmails"] !== undefined)
data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new AuthorizationDocumentInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["hostedNumberOrderSids"] === null ||
params["hostedNumberOrderSids"] === undefined) {
throw new Error("Required parameter \"params['hostedNumberOrderSids']\" missing.");
}
if (params["addressSid"] === null || params["addressSid"] === undefined) {
throw new Error("Required parameter \"params['addressSid']\" missing.");
}
if (params["email"] === null || params["email"] === undefined) {
throw new Error("Required parameter \"params['email']\" missing.");
}
if (params["contactTitle"] === null ||
params["contactTitle"] === undefined) {
throw new Error("Required parameter \"params['contactTitle']\" missing.");
}
if (params["contactPhoneNumber"] === null ||
params["contactPhoneNumber"] === undefined) {
throw new Error("Required parameter \"params['contactPhoneNumber']\" missing.");
}
let data = {};
data["HostedNumberOrderSids"] = serialize.map(params["hostedNumberOrderSids"], (e) => e);
data["AddressSid"] = params["addressSid"];
data["Email"] = params["email"];
data["ContactTitle"] = params["contactTitle"];
data["ContactPhoneNumber"] = params["contactPhoneNumber"];
if (params["ccEmails"] !== undefined)
data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new AuthorizationDocumentInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["email"] !== undefined)
data["Email"] = params["email"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new AuthorizationDocumentPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new AuthorizationDocumentPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["email"] !== undefined)
data["Email"] = params["email"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new AuthorizationDocumentPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new AuthorizationDocumentPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class AuthorizationDocumentPage extends Page_1.default {
/**
* Initialize the AuthorizationDocumentPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of AuthorizationDocumentInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new AuthorizationDocumentInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AuthorizationDocumentPage = AuthorizationDocumentPage;

View File

@@ -0,0 +1,351 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import HostedNumbers from "../../HostedNumbers";
import { ApiResponse } from "../../../../base/ApiResponse";
import { PhoneNumberCapabilities } from "../../../../interfaces";
/**
* Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
*/
export type DependentHostedNumberOrderStatus = "twilio-processing" | "received" | "pending-verification" | "verified" | "pending-loa" | "carrier-processing" | "testing" | "completed" | "failed" | "action-required";
/**
* The method used for verifying ownership of the number to be hosted. One of phone-call (default) or phone-bill.
*/
export type DependentHostedNumberOrderVerificationType = "phone-call" | "phone-bill";
/**
* Options to pass to each
*/
export interface DependentHostedNumberOrderListInstanceEachOptions {
/** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */
status?: DependentHostedNumberOrderStatus;
/** An E164 formatted phone number hosted by this HostedNumberOrder. */
phoneNumber?: string;
/** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */
incomingPhoneNumberSid?: string;
/** A human readable description of this resource, up to 64 characters. */
friendlyName?: string;
/** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */
uniqueName?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface DependentHostedNumberOrderListInstanceOptions {
/** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */
status?: DependentHostedNumberOrderStatus;
/** An E164 formatted phone number hosted by this HostedNumberOrder. */
phoneNumber?: string;
/** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */
incomingPhoneNumberSid?: string;
/** A human readable description of this resource, up to 64 characters. */
friendlyName?: string;
/** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */
uniqueName?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface DependentHostedNumberOrderListInstancePageOptions {
/** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */
status?: DependentHostedNumberOrderStatus;
/** An E164 formatted phone number hosted by this HostedNumberOrder. */
phoneNumber?: string;
/** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */
incomingPhoneNumberSid?: string;
/** A human readable description of this resource, up to 64 characters. */
friendlyName?: string;
/** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */
uniqueName?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface DependentHostedNumberOrderSolution {
signingDocumentSid: string;
}
export interface DependentHostedNumberOrderListInstance {
_version: HostedNumbers;
_solution: DependentHostedNumberOrderSolution;
_uri: string;
/**
* Streams DependentHostedNumberOrderInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DependentHostedNumberOrderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
each(params: DependentHostedNumberOrderListInstanceEachOptions, callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
/**
* Streams DependentHostedNumberOrderInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DependentHostedNumberOrderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: DependentHostedNumberOrderListInstanceEachOptions, callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of DependentHostedNumberOrderInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: DependentHostedNumberOrderPage) => any): Promise<DependentHostedNumberOrderPage>;
/**
* Retrieve a single target page of DependentHostedNumberOrderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<DependentHostedNumberOrderPage>) => any): Promise<ApiResponse<DependentHostedNumberOrderPage>>;
/**
* Lists DependentHostedNumberOrderInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DependentHostedNumberOrderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: DependentHostedNumberOrderInstance[]) => any): Promise<DependentHostedNumberOrderInstance[]>;
list(params: DependentHostedNumberOrderListInstanceOptions, callback?: (error: Error | null, items: DependentHostedNumberOrderInstance[]) => any): Promise<DependentHostedNumberOrderInstance[]>;
/**
* Lists DependentHostedNumberOrderInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DependentHostedNumberOrderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<DependentHostedNumberOrderInstance[]>) => any): Promise<ApiResponse<DependentHostedNumberOrderInstance[]>>;
listWithHttpInfo(params: DependentHostedNumberOrderListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<DependentHostedNumberOrderInstance[]>) => any): Promise<ApiResponse<DependentHostedNumberOrderInstance[]>>;
/**
* Retrieve a single page of DependentHostedNumberOrderInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DependentHostedNumberOrderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: DependentHostedNumberOrderPage) => any): Promise<DependentHostedNumberOrderPage>;
page(params: DependentHostedNumberOrderListInstancePageOptions, callback?: (error: Error | null, items: DependentHostedNumberOrderPage) => any): Promise<DependentHostedNumberOrderPage>;
/**
* Retrieve a single page of DependentHostedNumberOrderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { DependentHostedNumberOrderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<DependentHostedNumberOrderPage>) => any): Promise<ApiResponse<DependentHostedNumberOrderPage>>;
pageWithHttpInfo(params: DependentHostedNumberOrderListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<DependentHostedNumberOrderPage>) => any): Promise<ApiResponse<DependentHostedNumberOrderPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function DependentHostedNumberOrderListInstance(version: HostedNumbers, signingDocumentSid: string): DependentHostedNumberOrderListInstance;
interface DependentHostedNumberOrderPayload extends TwilioResponsePayload {
items: DependentHostedNumberOrderResource[];
}
interface DependentHostedNumberOrderResource {
sid: string;
account_sid: string;
incoming_phone_number_sid: string;
address_sid: string;
signing_document_sid: string;
phone_number: string;
capabilities: PhoneNumberCapabilities;
friendly_name: string;
unique_name: string;
status: DependentHostedNumberOrderStatus;
failure_reason: string;
date_created: Date;
date_updated: Date;
verification_attempts: number;
email: string;
cc_emails: Array<string>;
verification_type: DependentHostedNumberOrderVerificationType;
verification_document_sid: string;
extension: string;
call_delay: number;
verification_code: string;
verification_call_sids: Array<string>;
}
export declare class DependentHostedNumberOrderInstance {
protected _version: HostedNumbers;
constructor(_version: HostedNumbers, payload: DependentHostedNumberOrderResource, signingDocumentSid: string);
/**
* A 34 character string that uniquely identifies this Authorization Document
*/
sid: string;
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
*/
incomingPhoneNumberSid: string;
/**
* A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
*/
addressSid: string;
/**
* A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder.
*/
signingDocumentSid: string;
/**
* An E164 formatted phone number hosted by this HostedNumberOrder.
*/
phoneNumber: string;
capabilities: PhoneNumberCapabilities;
/**
* A human readable description of this resource, up to 64 characters.
*/
friendlyName: string;
/**
* Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID.
*/
uniqueName: string;
status: DependentHostedNumberOrderStatus;
/**
* A message that explains why a hosted_number_order went to status \"action-required\"
*/
failureReason: string;
/**
* The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The number of attempts made to verify ownership of the phone number that is being hosted.
*/
verificationAttempts: number;
/**
* Email of the owner of this phone number that is being hosted.
*/
email: string;
/**
* Email recipients who will be informed when an Authorization Document has been sent and signed
*/
ccEmails: Array<string>;
verificationType: DependentHostedNumberOrderVerificationType;
/**
* A 34 character string that uniquely identifies the Identity Document resource that represents the document for verifying ownership of the number to be hosted.
*/
verificationDocumentSid: string;
/**
* A numerical extension to be used when making the ownership verification call.
*/
extension: string;
/**
* A value between 0-30 specifying the number of seconds to delay initiating the ownership verification call.
*/
callDelay: number;
/**
* The digits passed during the ownership verification call.
*/
verificationCode: string;
/**
* A list of 34 character strings that are unique identifiers for the calls placed as part of ownership verification.
*/
verificationCallSids: Array<string>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
incomingPhoneNumberSid: string;
addressSid: string;
signingDocumentSid: string;
phoneNumber: string;
capabilities: PhoneNumberCapabilities;
friendlyName: string;
uniqueName: string;
status: DependentHostedNumberOrderStatus;
failureReason: string;
dateCreated: Date;
dateUpdated: Date;
verificationAttempts: number;
email: string;
ccEmails: string[];
verificationType: DependentHostedNumberOrderVerificationType;
verificationDocumentSid: string;
extension: string;
callDelay: number;
verificationCode: string;
verificationCallSids: string[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class DependentHostedNumberOrderPage extends Page<HostedNumbers, DependentHostedNumberOrderPayload, DependentHostedNumberOrderResource, DependentHostedNumberOrderInstance> {
/**
* Initialize the DependentHostedNumberOrderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: HostedNumbers, response: Response<string>, solution: DependentHostedNumberOrderSolution);
/**
* Build an instance of DependentHostedNumberOrderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: DependentHostedNumberOrderResource): DependentHostedNumberOrderInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,233 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DependentHostedNumberOrderPage = exports.DependentHostedNumberOrderInstance = void 0;
exports.DependentHostedNumberOrderListInstance = DependentHostedNumberOrderListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
function DependentHostedNumberOrderListInstance(version, signingDocumentSid) {
if (!(0, utility_1.isValidPathParam)(signingDocumentSid)) {
throw new Error("Parameter 'signingDocumentSid' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { signingDocumentSid };
instance._uri = `/AuthorizationDocuments/${signingDocumentSid}/DependentHostedNumberOrders`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["phoneNumber"] !== undefined)
data["PhoneNumber"] = params["phoneNumber"];
if (params["incomingPhoneNumberSid"] !== undefined)
data["IncomingPhoneNumberSid"] = params["incomingPhoneNumberSid"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new DependentHostedNumberOrderPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new DependentHostedNumberOrderPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["phoneNumber"] !== undefined)
data["PhoneNumber"] = params["phoneNumber"];
if (params["incomingPhoneNumberSid"] !== undefined)
data["IncomingPhoneNumberSid"] = params["incomingPhoneNumberSid"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new DependentHostedNumberOrderPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new DependentHostedNumberOrderPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class DependentHostedNumberOrderInstance {
constructor(_version, payload, signingDocumentSid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.incomingPhoneNumberSid = payload.incoming_phone_number_sid;
this.addressSid = payload.address_sid;
this.signingDocumentSid = payload.signing_document_sid;
this.phoneNumber = payload.phone_number;
this.capabilities = payload.capabilities;
this.friendlyName = payload.friendly_name;
this.uniqueName = payload.unique_name;
this.status = payload.status;
this.failureReason = payload.failure_reason;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.verificationAttempts = deserialize.integer(payload.verification_attempts);
this.email = payload.email;
this.ccEmails = payload.cc_emails;
this.verificationType = payload.verification_type;
this.verificationDocumentSid = payload.verification_document_sid;
this.extension = payload.extension;
this.callDelay = deserialize.integer(payload.call_delay);
this.verificationCode = payload.verification_code;
this.verificationCallSids = payload.verification_call_sids;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
incomingPhoneNumberSid: this.incomingPhoneNumberSid,
addressSid: this.addressSid,
signingDocumentSid: this.signingDocumentSid,
phoneNumber: this.phoneNumber,
capabilities: this.capabilities,
friendlyName: this.friendlyName,
uniqueName: this.uniqueName,
status: this.status,
failureReason: this.failureReason,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
verificationAttempts: this.verificationAttempts,
email: this.email,
ccEmails: this.ccEmails,
verificationType: this.verificationType,
verificationDocumentSid: this.verificationDocumentSid,
extension: this.extension,
callDelay: this.callDelay,
verificationCode: this.verificationCode,
verificationCallSids: this.verificationCallSids,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DependentHostedNumberOrderInstance = DependentHostedNumberOrderInstance;
class DependentHostedNumberOrderPage extends Page_1.default {
/**
* Initialize the DependentHostedNumberOrderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of DependentHostedNumberOrderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new DependentHostedNumberOrderInstance(this._version, payload, this._solution.signingDocumentSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DependentHostedNumberOrderPage = DependentHostedNumberOrderPage;

View File

@@ -0,0 +1,604 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import HostedNumbers from "../HostedNumbers";
import { ApiResponse } from "../../../base/ApiResponse";
import { PhoneNumberCapabilities } from "../../../interfaces";
/**
* Status of this resource. It can hold one of the values: 1. Twilio Processing 2. Received, 3. Pending LOA, 4. Carrier Processing, 5. Completed, 6. Action Required, 7. Failed. See the [HostedNumberOrders Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values) section for more information on each of these statuses.
*/
export type HostedNumberOrderStatus = "twilio-processing" | "received" | "pending-verification" | "verified" | "pending-loa" | "carrier-processing" | "testing" | "completed" | "failed" | "action-required";
/**
* The type of ownership verification required to move the number to a `verified` state. The verification methods are `phone-call` or `phone-bill`.
*/
export type HostedNumberOrderVerificationType = "phone-call" | "phone-bill";
/**
* Options to pass to update a HostedNumberOrderInstance
*/
export interface HostedNumberOrderContextUpdateOptions {
/** A 64 character string that is a human readable text that describes this resource. */
friendlyName?: string;
/** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */
uniqueName?: string;
/** Email of the owner of this phone number that is being hosted. */
email?: string;
/** Optional. A list of emails that LOA document for this HostedNumberOrder will be carbon copied to. */
ccEmails?: Array<string>;
/** */
status?: HostedNumberOrderStatus;
/** A verification code that is given to the user via a phone call to the phone number that is being hosted. */
verificationCode?: string;
/** */
verificationType?: HostedNumberOrderVerificationType;
/** Optional. The unique sid identifier of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when VerificationType is phone-bill. */
verificationDocumentSid?: string;
/** Digits to dial after connecting the verification call. */
extension?: string;
/** The number of seconds, between 0 and 60, to delay before initiating the verification call. Defaults to 0. */
callDelay?: number;
}
/**
* Options to pass to create a HostedNumberOrderInstance
*/
export interface HostedNumberOrderListInstanceCreateOptions {
/** The number to host in [+E.164](https://en.wikipedia.org/wiki/E.164) format */
phoneNumber: string;
/** Used to specify that the SMS capability will be hosted on Twilio\\\'s platform. */
smsCapability: boolean;
/** This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to. */
accountSid?: string;
/** A 64 character string that is a human readable text that describes this resource. */
friendlyName?: string;
/** Optional. Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */
uniqueName?: string;
/** Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to. */
ccEmails?: Array<string>;
/** The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource. */
smsUrl?: string;
/** The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. */
smsMethod?: string;
/** A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource. */
smsFallbackUrl?: string;
/** The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. */
smsFallbackMethod?: string;
/** Optional. The Status Callback URL attached to the IncomingPhoneNumber resource. */
statusCallbackUrl?: string;
/** Optional. The Status Callback Method attached to the IncomingPhoneNumber resource. */
statusCallbackMethod?: string;
/** Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application. */
smsApplicationSid?: string;
/** Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. */
addressSid?: string;
/** Optional. Email of the owner of this phone number that is being hosted. */
email?: string;
/** */
verificationType?: HostedNumberOrderVerificationType;
/** Optional. The unique sid identifier of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when VerificationType is phone-bill. */
verificationDocumentSid?: string;
}
/**
* Options to pass to each
*/
export interface HostedNumberOrderListInstanceEachOptions {
/** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */
status?: HostedNumberOrderStatus;
/** An E164 formatted phone number hosted by this HostedNumberOrder. */
phoneNumber?: string;
/** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */
incomingPhoneNumberSid?: string;
/** A human readable description of this resource, up to 64 characters. */
friendlyName?: string;
/** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */
uniqueName?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface HostedNumberOrderListInstanceOptions {
/** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */
status?: HostedNumberOrderStatus;
/** An E164 formatted phone number hosted by this HostedNumberOrder. */
phoneNumber?: string;
/** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */
incomingPhoneNumberSid?: string;
/** A human readable description of this resource, up to 64 characters. */
friendlyName?: string;
/** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */
uniqueName?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface HostedNumberOrderListInstancePageOptions {
/** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */
status?: HostedNumberOrderStatus;
/** An E164 formatted phone number hosted by this HostedNumberOrder. */
phoneNumber?: string;
/** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */
incomingPhoneNumberSid?: string;
/** A human readable description of this resource, up to 64 characters. */
friendlyName?: string;
/** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */
uniqueName?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface HostedNumberOrderContext {
/**
* Remove a HostedNumberOrderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a HostedNumberOrderInstance 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 HostedNumberOrderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance
*/
fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
/**
* Fetch a HostedNumberOrderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any): Promise<ApiResponse<HostedNumberOrderInstance>>;
/**
* Update a HostedNumberOrderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance
*/
update(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
/**
* Update a HostedNumberOrderInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance
*/
update(params: HostedNumberOrderContextUpdateOptions, callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
/**
* Update a HostedNumberOrderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any): Promise<ApiResponse<HostedNumberOrderInstance>>;
/**
* Update a HostedNumberOrderInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance with HTTP metadata
*/
updateWithHttpInfo(params: HostedNumberOrderContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any): Promise<ApiResponse<HostedNumberOrderInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface HostedNumberOrderContextSolution {
sid: string;
}
export declare class HostedNumberOrderContextImpl implements HostedNumberOrderContext {
protected _version: HostedNumbers;
protected _solution: HostedNumberOrderContextSolution;
protected _uri: string;
constructor(_version: HostedNumbers, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any): Promise<ApiResponse<HostedNumberOrderInstance>>;
update(params?: HostedNumberOrderContextUpdateOptions | ((error: Error | null, item?: HostedNumberOrderInstance) => any), callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
updateWithHttpInfo(params?: HostedNumberOrderContextUpdateOptions | ((error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any): Promise<ApiResponse<HostedNumberOrderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): HostedNumberOrderContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface HostedNumberOrderPayload extends TwilioResponsePayload {
items: HostedNumberOrderResource[];
}
interface HostedNumberOrderResource {
sid: string;
account_sid: string;
incoming_phone_number_sid: string;
address_sid: string;
signing_document_sid: string;
phone_number: string;
capabilities: PhoneNumberCapabilities;
friendly_name: string;
unique_name: string;
status: HostedNumberOrderStatus;
failure_reason: string;
date_created: Date;
date_updated: Date;
verification_attempts: number;
email: string;
cc_emails: Array<string>;
url: string;
verification_type: HostedNumberOrderVerificationType;
verification_document_sid: string;
extension: string;
call_delay: number;
verification_code: string;
verification_call_sids: Array<string>;
}
export declare class HostedNumberOrderInstance {
protected _version: HostedNumbers;
protected _solution: HostedNumberOrderContextSolution;
protected _context?: HostedNumberOrderContext;
constructor(_version: HostedNumbers, payload: HostedNumberOrderResource, sid?: string);
/**
* A 34 character string that uniquely identifies this HostedNumberOrder.
*/
sid: string;
/**
* A 34 character string that uniquely identifies the account.
*/
accountSid: string;
/**
* A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the phone number being hosted.
*/
incomingPhoneNumberSid: string;
/**
* A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
*/
addressSid: string;
/**
* A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource) the user needs to sign.
*/
signingDocumentSid: string;
/**
* Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212
*/
phoneNumber: string;
capabilities: PhoneNumberCapabilities;
/**
* A 64 character string that is a human-readable text that describes this resource.
*/
friendlyName: string;
/**
* Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID.
*/
uniqueName: string;
status: HostedNumberOrderStatus;
/**
* A message that explains why a hosted_number_order went to status \"action-required\"
*/
failureReason: string;
/**
* The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The number of attempts made to verify ownership of the phone number that is being hosted.
*/
verificationAttempts: number;
/**
* Email of the owner of this phone number that is being hosted.
*/
email: string;
/**
* A list of emails that LOA document for this HostedNumberOrder will be carbon copied to.
*/
ccEmails: Array<string>;
/**
* The URL of this HostedNumberOrder.
*/
url: string;
verificationType: HostedNumberOrderVerificationType;
/**
* A 34 character string that uniquely identifies the Identity Document resource that represents the document for verifying ownership of the number to be hosted.
*/
verificationDocumentSid: string;
/**
* A numerical extension to be used when making the ownership verification call.
*/
extension: string;
/**
* A value between 0-30 specifying the number of seconds to delay initiating the ownership verification call.
*/
callDelay: number;
/**
* A verification code provided in the response for a user to enter when they pick up the phone call.
*/
verificationCode: string;
/**
* A list of 34 character strings that are unique identifiers for the calls placed as part of ownership verification.
*/
verificationCallSids: Array<string>;
private get _proxy();
/**
* Remove a HostedNumberOrderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a HostedNumberOrderInstance 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 HostedNumberOrderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance
*/
fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
/**
* Fetch a HostedNumberOrderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any): Promise<ApiResponse<HostedNumberOrderInstance>>;
/**
* Update a HostedNumberOrderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance
*/
update(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
/**
* Update a HostedNumberOrderInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance
*/
update(params: HostedNumberOrderContextUpdateOptions, callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
/**
* Update a HostedNumberOrderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any): Promise<ApiResponse<HostedNumberOrderInstance>>;
/**
* Update a HostedNumberOrderInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance with HTTP metadata
*/
updateWithHttpInfo(params: HostedNumberOrderContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any): Promise<ApiResponse<HostedNumberOrderInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
incomingPhoneNumberSid: string;
addressSid: string;
signingDocumentSid: string;
phoneNumber: string;
capabilities: PhoneNumberCapabilities;
friendlyName: string;
uniqueName: string;
status: HostedNumberOrderStatus;
failureReason: string;
dateCreated: Date;
dateUpdated: Date;
verificationAttempts: number;
email: string;
ccEmails: string[];
url: string;
verificationType: HostedNumberOrderVerificationType;
verificationDocumentSid: string;
extension: string;
callDelay: number;
verificationCode: string;
verificationCallSids: string[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface HostedNumberOrderSolution {
}
export interface HostedNumberOrderListInstance {
_version: HostedNumbers;
_solution: HostedNumberOrderSolution;
_uri: string;
(sid: string): HostedNumberOrderContext;
get(sid: string): HostedNumberOrderContext;
/**
* Create a HostedNumberOrderInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance
*/
create(params: HostedNumberOrderListInstanceCreateOptions, callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
/**
* Create a HostedNumberOrderInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance with HTTP metadata
*/
createWithHttpInfo(params: HostedNumberOrderListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<HostedNumberOrderInstance>) => any): Promise<ApiResponse<HostedNumberOrderInstance>>;
/**
* Streams HostedNumberOrderInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { HostedNumberOrderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
each(params: HostedNumberOrderListInstanceEachOptions, callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
/**
* Streams HostedNumberOrderInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { HostedNumberOrderListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: HostedNumberOrderListInstanceEachOptions, callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of HostedNumberOrderInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>;
/**
* Retrieve a single target page of HostedNumberOrderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<HostedNumberOrderPage>) => any): Promise<ApiResponse<HostedNumberOrderPage>>;
/**
* Lists HostedNumberOrderInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { HostedNumberOrderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: HostedNumberOrderInstance[]) => any): Promise<HostedNumberOrderInstance[]>;
list(params: HostedNumberOrderListInstanceOptions, callback?: (error: Error | null, items: HostedNumberOrderInstance[]) => any): Promise<HostedNumberOrderInstance[]>;
/**
* Lists HostedNumberOrderInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { HostedNumberOrderListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<HostedNumberOrderInstance[]>) => any): Promise<ApiResponse<HostedNumberOrderInstance[]>>;
listWithHttpInfo(params: HostedNumberOrderListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<HostedNumberOrderInstance[]>) => any): Promise<ApiResponse<HostedNumberOrderInstance[]>>;
/**
* Retrieve a single page of HostedNumberOrderInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { HostedNumberOrderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>;
page(params: HostedNumberOrderListInstancePageOptions, callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>;
/**
* Retrieve a single page of HostedNumberOrderInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { HostedNumberOrderListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<HostedNumberOrderPage>) => any): Promise<ApiResponse<HostedNumberOrderPage>>;
pageWithHttpInfo(params: HostedNumberOrderListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<HostedNumberOrderPage>) => any): Promise<ApiResponse<HostedNumberOrderPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function HostedNumberOrderListInstance(version: HostedNumbers): HostedNumberOrderListInstance;
export declare class HostedNumberOrderPage extends Page<HostedNumbers, HostedNumberOrderPayload, HostedNumberOrderResource, HostedNumberOrderInstance> {
/**
* Initialize the HostedNumberOrderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: HostedNumbers, response: Response<string>, solution: HostedNumberOrderSolution);
/**
* Build an instance of HostedNumberOrderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: HostedNumberOrderResource): HostedNumberOrderInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,579 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HostedNumberOrderPage = exports.HostedNumberOrderInstance = exports.HostedNumberOrderContextImpl = void 0;
exports.HostedNumberOrderListInstance = HostedNumberOrderListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class HostedNumberOrderContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/HostedNumberOrders/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new HostedNumberOrderInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
if (params["ccEmails"] !== undefined)
data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e);
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["verificationCode"] !== undefined)
data["VerificationCode"] = params["verificationCode"];
if (params["verificationType"] !== undefined)
data["VerificationType"] = params["verificationType"];
if (params["verificationDocumentSid"] !== undefined)
data["VerificationDocumentSid"] = params["verificationDocumentSid"];
if (params["extension"] !== undefined)
data["Extension"] = params["extension"];
if (params["callDelay"] !== undefined)
data["CallDelay"] = params["callDelay"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
if (params["ccEmails"] !== undefined)
data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e);
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["verificationCode"] !== undefined)
data["VerificationCode"] = params["verificationCode"];
if (params["verificationType"] !== undefined)
data["VerificationType"] = params["verificationType"];
if (params["verificationDocumentSid"] !== undefined)
data["VerificationDocumentSid"] = params["verificationDocumentSid"];
if (params["extension"] !== undefined)
data["Extension"] = params["extension"];
if (params["callDelay"] !== undefined)
data["CallDelay"] = params["callDelay"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new HostedNumberOrderInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.HostedNumberOrderContextImpl = HostedNumberOrderContextImpl;
class HostedNumberOrderInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.incomingPhoneNumberSid = payload.incoming_phone_number_sid;
this.addressSid = payload.address_sid;
this.signingDocumentSid = payload.signing_document_sid;
this.phoneNumber = payload.phone_number;
this.capabilities = payload.capabilities;
this.friendlyName = payload.friendly_name;
this.uniqueName = payload.unique_name;
this.status = payload.status;
this.failureReason = payload.failure_reason;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.verificationAttempts = deserialize.integer(payload.verification_attempts);
this.email = payload.email;
this.ccEmails = payload.cc_emails;
this.url = payload.url;
this.verificationType = payload.verification_type;
this.verificationDocumentSid = payload.verification_document_sid;
this.extension = payload.extension;
this.callDelay = deserialize.integer(payload.call_delay);
this.verificationCode = payload.verification_code;
this.verificationCallSids = payload.verification_call_sids;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new HostedNumberOrderContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a HostedNumberOrderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a HostedNumberOrderInstance 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 HostedNumberOrderInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a HostedNumberOrderInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed HostedNumberOrderInstance 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 {
sid: this.sid,
accountSid: this.accountSid,
incomingPhoneNumberSid: this.incomingPhoneNumberSid,
addressSid: this.addressSid,
signingDocumentSid: this.signingDocumentSid,
phoneNumber: this.phoneNumber,
capabilities: this.capabilities,
friendlyName: this.friendlyName,
uniqueName: this.uniqueName,
status: this.status,
failureReason: this.failureReason,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
verificationAttempts: this.verificationAttempts,
email: this.email,
ccEmails: this.ccEmails,
url: this.url,
verificationType: this.verificationType,
verificationDocumentSid: this.verificationDocumentSid,
extension: this.extension,
callDelay: this.callDelay,
verificationCode: this.verificationCode,
verificationCallSids: this.verificationCallSids,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.HostedNumberOrderInstance = HostedNumberOrderInstance;
function HostedNumberOrderListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new HostedNumberOrderContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/HostedNumberOrders`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["phoneNumber"] === null || params["phoneNumber"] === undefined) {
throw new Error("Required parameter \"params['phoneNumber']\" missing.");
}
if (params["smsCapability"] === null ||
params["smsCapability"] === undefined) {
throw new Error("Required parameter \"params['smsCapability']\" missing.");
}
let data = {};
data["PhoneNumber"] = params["phoneNumber"];
data["SmsCapability"] = serialize.bool(params["smsCapability"]);
if (params["accountSid"] !== undefined)
data["AccountSid"] = params["accountSid"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["ccEmails"] !== undefined)
data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e);
if (params["smsUrl"] !== undefined)
data["SmsUrl"] = params["smsUrl"];
if (params["smsMethod"] !== undefined)
data["SmsMethod"] = params["smsMethod"];
if (params["smsFallbackUrl"] !== undefined)
data["SmsFallbackUrl"] = params["smsFallbackUrl"];
if (params["smsFallbackMethod"] !== undefined)
data["SmsFallbackMethod"] = params["smsFallbackMethod"];
if (params["statusCallbackUrl"] !== undefined)
data["StatusCallbackUrl"] = params["statusCallbackUrl"];
if (params["statusCallbackMethod"] !== undefined)
data["StatusCallbackMethod"] = params["statusCallbackMethod"];
if (params["smsApplicationSid"] !== undefined)
data["SmsApplicationSid"] = params["smsApplicationSid"];
if (params["addressSid"] !== undefined)
data["AddressSid"] = params["addressSid"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
if (params["verificationType"] !== undefined)
data["VerificationType"] = params["verificationType"];
if (params["verificationDocumentSid"] !== undefined)
data["VerificationDocumentSid"] = params["verificationDocumentSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["phoneNumber"] === null || params["phoneNumber"] === undefined) {
throw new Error("Required parameter \"params['phoneNumber']\" missing.");
}
if (params["smsCapability"] === null ||
params["smsCapability"] === undefined) {
throw new Error("Required parameter \"params['smsCapability']\" missing.");
}
let data = {};
data["PhoneNumber"] = params["phoneNumber"];
data["SmsCapability"] = serialize.bool(params["smsCapability"]);
if (params["accountSid"] !== undefined)
data["AccountSid"] = params["accountSid"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["ccEmails"] !== undefined)
data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e);
if (params["smsUrl"] !== undefined)
data["SmsUrl"] = params["smsUrl"];
if (params["smsMethod"] !== undefined)
data["SmsMethod"] = params["smsMethod"];
if (params["smsFallbackUrl"] !== undefined)
data["SmsFallbackUrl"] = params["smsFallbackUrl"];
if (params["smsFallbackMethod"] !== undefined)
data["SmsFallbackMethod"] = params["smsFallbackMethod"];
if (params["statusCallbackUrl"] !== undefined)
data["StatusCallbackUrl"] = params["statusCallbackUrl"];
if (params["statusCallbackMethod"] !== undefined)
data["StatusCallbackMethod"] = params["statusCallbackMethod"];
if (params["smsApplicationSid"] !== undefined)
data["SmsApplicationSid"] = params["smsApplicationSid"];
if (params["addressSid"] !== undefined)
data["AddressSid"] = params["addressSid"];
if (params["email"] !== undefined)
data["Email"] = params["email"];
if (params["verificationType"] !== undefined)
data["VerificationType"] = params["verificationType"];
if (params["verificationDocumentSid"] !== undefined)
data["VerificationDocumentSid"] = params["verificationDocumentSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new HostedNumberOrderInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["phoneNumber"] !== undefined)
data["PhoneNumber"] = params["phoneNumber"];
if (params["incomingPhoneNumberSid"] !== undefined)
data["IncomingPhoneNumberSid"] = params["incomingPhoneNumberSid"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new HostedNumberOrderPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new HostedNumberOrderPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["phoneNumber"] !== undefined)
data["PhoneNumber"] = params["phoneNumber"];
if (params["incomingPhoneNumberSid"] !== undefined)
data["IncomingPhoneNumberSid"] = params["incomingPhoneNumberSid"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new HostedNumberOrderPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new HostedNumberOrderPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class HostedNumberOrderPage extends Page_1.default {
/**
* Initialize the HostedNumberOrderPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of HostedNumberOrderInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new HostedNumberOrderInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.HostedNumberOrderPage = HostedNumberOrderPage;

View File

@@ -0,0 +1,300 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import Marketplace from "../Marketplace";
import { ApiResponse } from "../../../base/ApiResponse";
import { AvailableAddOnExtensionListInstance } from "./availableAddOn/availableAddOnExtension";
/**
* Options to pass to each
*/
export interface AvailableAddOnListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface AvailableAddOnListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface AvailableAddOnListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface AvailableAddOnContext {
extensions: AvailableAddOnExtensionListInstance;
/**
* Fetch a AvailableAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnInstance
*/
fetch(callback?: (error: Error | null, item?: AvailableAddOnInstance) => any): Promise<AvailableAddOnInstance>;
/**
* Fetch a AvailableAddOnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AvailableAddOnInstance>) => any): Promise<ApiResponse<AvailableAddOnInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface AvailableAddOnContextSolution {
sid: string;
}
export declare class AvailableAddOnContextImpl implements AvailableAddOnContext {
protected _version: Marketplace;
protected _solution: AvailableAddOnContextSolution;
protected _uri: string;
protected _extensions?: AvailableAddOnExtensionListInstance;
constructor(_version: Marketplace, sid: string);
get extensions(): AvailableAddOnExtensionListInstance;
fetch(callback?: (error: Error | null, item?: AvailableAddOnInstance) => any): Promise<AvailableAddOnInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AvailableAddOnInstance>) => any): Promise<ApiResponse<AvailableAddOnInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): AvailableAddOnContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AvailableAddOnPayload extends TwilioResponsePayload {
available_add_ons: AvailableAddOnResource[];
}
interface AvailableAddOnResource {
sid: string;
friendly_name: string;
description: string;
pricing_type: string;
configuration_schema: any;
url: string;
links: Record<string, string>;
}
export declare class AvailableAddOnInstance {
protected _version: Marketplace;
protected _solution: AvailableAddOnContextSolution;
protected _context?: AvailableAddOnContext;
constructor(_version: Marketplace, payload: AvailableAddOnResource, sid?: string);
/**
* The unique string that we created to identify the AvailableAddOn resource.
*/
sid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* A short description of the Add-on\'s functionality.
*/
description: string;
/**
* How customers are charged for using this Add-on.
*/
pricingType: string;
/**
* The JSON object with the configuration that must be provided when installing a given Add-on.
*/
configurationSchema: any;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of related resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Fetch a AvailableAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnInstance
*/
fetch(callback?: (error: Error | null, item?: AvailableAddOnInstance) => any): Promise<AvailableAddOnInstance>;
/**
* Fetch a AvailableAddOnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AvailableAddOnInstance>) => any): Promise<ApiResponse<AvailableAddOnInstance>>;
/**
* Access the extensions.
*/
extensions(): AvailableAddOnExtensionListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
friendlyName: string;
description: string;
pricingType: string;
configurationSchema: any;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AvailableAddOnSolution {
}
export interface AvailableAddOnListInstance {
_version: Marketplace;
_solution: AvailableAddOnSolution;
_uri: string;
(sid: string): AvailableAddOnContext;
get(sid: string): AvailableAddOnContext;
/**
* Streams AvailableAddOnInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void): void;
each(params: AvailableAddOnListInstanceEachOptions, callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void): void;
/**
* Streams AvailableAddOnInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: AvailableAddOnListInstanceEachOptions, callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of AvailableAddOnInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: AvailableAddOnPage) => any): Promise<AvailableAddOnPage>;
/**
* Retrieve a single target page of AvailableAddOnInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<AvailableAddOnPage>) => any): Promise<ApiResponse<AvailableAddOnPage>>;
/**
* Lists AvailableAddOnInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: AvailableAddOnInstance[]) => any): Promise<AvailableAddOnInstance[]>;
list(params: AvailableAddOnListInstanceOptions, callback?: (error: Error | null, items: AvailableAddOnInstance[]) => any): Promise<AvailableAddOnInstance[]>;
/**
* Lists AvailableAddOnInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AvailableAddOnInstance[]>) => any): Promise<ApiResponse<AvailableAddOnInstance[]>>;
listWithHttpInfo(params: AvailableAddOnListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AvailableAddOnInstance[]>) => any): Promise<ApiResponse<AvailableAddOnInstance[]>>;
/**
* Retrieve a single page of AvailableAddOnInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: AvailableAddOnPage) => any): Promise<AvailableAddOnPage>;
page(params: AvailableAddOnListInstancePageOptions, callback?: (error: Error | null, items: AvailableAddOnPage) => any): Promise<AvailableAddOnPage>;
/**
* Retrieve a single page of AvailableAddOnInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AvailableAddOnPage>) => any): Promise<ApiResponse<AvailableAddOnPage>>;
pageWithHttpInfo(params: AvailableAddOnListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AvailableAddOnPage>) => any): Promise<ApiResponse<AvailableAddOnPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AvailableAddOnListInstance(version: Marketplace): AvailableAddOnListInstance;
export declare class AvailableAddOnPage extends Page<Marketplace, AvailableAddOnPayload, AvailableAddOnResource, AvailableAddOnInstance> {
/**
* Initialize the AvailableAddOnPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: Marketplace, response: Response<string>, solution: AvailableAddOnSolution);
/**
* Build an instance of AvailableAddOnInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: AvailableAddOnResource): AvailableAddOnInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,277 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AvailableAddOnPage = exports.AvailableAddOnInstance = exports.AvailableAddOnContextImpl = void 0;
exports.AvailableAddOnListInstance = AvailableAddOnListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const availableAddOnExtension_1 = require("./availableAddOn/availableAddOnExtension");
class AvailableAddOnContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/AvailableAddOns/${sid}`;
}
get extensions() {
this._extensions =
this._extensions ||
(0, availableAddOnExtension_1.AvailableAddOnExtensionListInstance)(this._version, this._solution.sid);
return this._extensions;
}
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 AvailableAddOnInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new AvailableAddOnInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AvailableAddOnContextImpl = AvailableAddOnContextImpl;
class AvailableAddOnInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.friendlyName = payload.friendly_name;
this.description = payload.description;
this.pricingType = payload.pricing_type;
this.configurationSchema = payload.configuration_schema;
this.url = payload.url;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new AvailableAddOnContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a AvailableAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a AvailableAddOnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the extensions.
*/
extensions() {
return this._proxy.extensions;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
friendlyName: this.friendlyName,
description: this.description,
pricingType: this.pricingType,
configurationSchema: this.configurationSchema,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AvailableAddOnInstance = AvailableAddOnInstance;
function AvailableAddOnListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new AvailableAddOnContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/AvailableAddOns`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new AvailableAddOnPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new AvailableAddOnPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new AvailableAddOnPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new AvailableAddOnPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class AvailableAddOnPage extends Page_1.default {
/**
* Initialize the AvailableAddOnPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of AvailableAddOnInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new AvailableAddOnInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AvailableAddOnPage = AvailableAddOnPage;

View File

@@ -0,0 +1,288 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import Marketplace from "../../Marketplace";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface AvailableAddOnExtensionListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface AvailableAddOnExtensionListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface AvailableAddOnExtensionListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface AvailableAddOnExtensionContext {
/**
* Fetch a AvailableAddOnExtensionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnExtensionInstance
*/
fetch(callback?: (error: Error | null, item?: AvailableAddOnExtensionInstance) => any): Promise<AvailableAddOnExtensionInstance>;
/**
* Fetch a AvailableAddOnExtensionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnExtensionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AvailableAddOnExtensionInstance>) => any): Promise<ApiResponse<AvailableAddOnExtensionInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface AvailableAddOnExtensionContextSolution {
availableAddOnSid: string;
sid: string;
}
export declare class AvailableAddOnExtensionContextImpl implements AvailableAddOnExtensionContext {
protected _version: Marketplace;
protected _solution: AvailableAddOnExtensionContextSolution;
protected _uri: string;
constructor(_version: Marketplace, availableAddOnSid: string, sid: string);
fetch(callback?: (error: Error | null, item?: AvailableAddOnExtensionInstance) => any): Promise<AvailableAddOnExtensionInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AvailableAddOnExtensionInstance>) => any): Promise<ApiResponse<AvailableAddOnExtensionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): AvailableAddOnExtensionContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AvailableAddOnExtensionPayload extends TwilioResponsePayload {
extensions: AvailableAddOnExtensionResource[];
}
interface AvailableAddOnExtensionResource {
sid: string;
available_add_on_sid: string;
friendly_name: string;
product_name: string;
unique_name: string;
url: string;
}
export declare class AvailableAddOnExtensionInstance {
protected _version: Marketplace;
protected _solution: AvailableAddOnExtensionContextSolution;
protected _context?: AvailableAddOnExtensionContext;
constructor(_version: Marketplace, payload: AvailableAddOnExtensionResource, availableAddOnSid: string, sid?: string);
/**
* The unique string that we created to identify the AvailableAddOnExtension resource.
*/
sid: string;
/**
* The SID of the AvailableAddOn resource to which this extension applies.
*/
availableAddOnSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The name of the Product this Extension is used within.
*/
productName: string;
/**
* An application-defined string that uniquely identifies the resource.
*/
uniqueName: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a AvailableAddOnExtensionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnExtensionInstance
*/
fetch(callback?: (error: Error | null, item?: AvailableAddOnExtensionInstance) => any): Promise<AvailableAddOnExtensionInstance>;
/**
* Fetch a AvailableAddOnExtensionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnExtensionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AvailableAddOnExtensionInstance>) => any): Promise<ApiResponse<AvailableAddOnExtensionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
availableAddOnSid: string;
friendlyName: string;
productName: string;
uniqueName: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AvailableAddOnExtensionSolution {
availableAddOnSid: string;
}
export interface AvailableAddOnExtensionListInstance {
_version: Marketplace;
_solution: AvailableAddOnExtensionSolution;
_uri: string;
(sid: string): AvailableAddOnExtensionContext;
get(sid: string): AvailableAddOnExtensionContext;
/**
* Streams AvailableAddOnExtensionInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnExtensionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void): void;
each(params: AvailableAddOnExtensionListInstanceEachOptions, callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void): void;
/**
* Streams AvailableAddOnExtensionInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnExtensionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: AvailableAddOnExtensionListInstanceEachOptions, callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of AvailableAddOnExtensionInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: AvailableAddOnExtensionPage) => any): Promise<AvailableAddOnExtensionPage>;
/**
* Retrieve a single target page of AvailableAddOnExtensionInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<AvailableAddOnExtensionPage>) => any): Promise<ApiResponse<AvailableAddOnExtensionPage>>;
/**
* Lists AvailableAddOnExtensionInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnExtensionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: AvailableAddOnExtensionInstance[]) => any): Promise<AvailableAddOnExtensionInstance[]>;
list(params: AvailableAddOnExtensionListInstanceOptions, callback?: (error: Error | null, items: AvailableAddOnExtensionInstance[]) => any): Promise<AvailableAddOnExtensionInstance[]>;
/**
* Lists AvailableAddOnExtensionInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnExtensionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AvailableAddOnExtensionInstance[]>) => any): Promise<ApiResponse<AvailableAddOnExtensionInstance[]>>;
listWithHttpInfo(params: AvailableAddOnExtensionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AvailableAddOnExtensionInstance[]>) => any): Promise<ApiResponse<AvailableAddOnExtensionInstance[]>>;
/**
* Retrieve a single page of AvailableAddOnExtensionInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnExtensionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: AvailableAddOnExtensionPage) => any): Promise<AvailableAddOnExtensionPage>;
page(params: AvailableAddOnExtensionListInstancePageOptions, callback?: (error: Error | null, items: AvailableAddOnExtensionPage) => any): Promise<AvailableAddOnExtensionPage>;
/**
* Retrieve a single page of AvailableAddOnExtensionInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AvailableAddOnExtensionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AvailableAddOnExtensionPage>) => any): Promise<ApiResponse<AvailableAddOnExtensionPage>>;
pageWithHttpInfo(params: AvailableAddOnExtensionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AvailableAddOnExtensionPage>) => any): Promise<ApiResponse<AvailableAddOnExtensionPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AvailableAddOnExtensionListInstance(version: Marketplace, availableAddOnSid: string): AvailableAddOnExtensionListInstance;
export declare class AvailableAddOnExtensionPage extends Page<Marketplace, AvailableAddOnExtensionPayload, AvailableAddOnExtensionResource, AvailableAddOnExtensionInstance> {
/**
* Initialize the AvailableAddOnExtensionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: Marketplace, response: Response<string>, solution: AvailableAddOnExtensionSolution);
/**
* Build an instance of AvailableAddOnExtensionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: AvailableAddOnExtensionResource): AvailableAddOnExtensionInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,268 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AvailableAddOnExtensionPage = exports.AvailableAddOnExtensionInstance = exports.AvailableAddOnExtensionContextImpl = void 0;
exports.AvailableAddOnExtensionListInstance = AvailableAddOnExtensionListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class AvailableAddOnExtensionContextImpl {
constructor(_version, availableAddOnSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(availableAddOnSid)) {
throw new Error("Parameter 'availableAddOnSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { availableAddOnSid, sid };
this._uri = `/AvailableAddOns/${availableAddOnSid}/Extensions/${sid}`;
}
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 AvailableAddOnExtensionInstance(operationVersion, payload, instance._solution.availableAddOnSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new AvailableAddOnExtensionInstance(operationVersion, response.body, instance._solution.availableAddOnSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AvailableAddOnExtensionContextImpl = AvailableAddOnExtensionContextImpl;
class AvailableAddOnExtensionInstance {
constructor(_version, payload, availableAddOnSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.availableAddOnSid = payload.available_add_on_sid;
this.friendlyName = payload.friendly_name;
this.productName = payload.product_name;
this.uniqueName = payload.unique_name;
this.url = payload.url;
this._solution = { availableAddOnSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new AvailableAddOnExtensionContextImpl(this._version, this._solution.availableAddOnSid, this._solution.sid);
return this._context;
}
/**
* Fetch a AvailableAddOnExtensionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnExtensionInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a AvailableAddOnExtensionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AvailableAddOnExtensionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
availableAddOnSid: this.availableAddOnSid,
friendlyName: this.friendlyName,
productName: this.productName,
uniqueName: this.uniqueName,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AvailableAddOnExtensionInstance = AvailableAddOnExtensionInstance;
function AvailableAddOnExtensionListInstance(version, availableAddOnSid) {
if (!(0, utility_1.isValidPathParam)(availableAddOnSid)) {
throw new Error("Parameter 'availableAddOnSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new AvailableAddOnExtensionContextImpl(version, availableAddOnSid, sid);
};
instance._version = version;
instance._solution = { availableAddOnSid };
instance._uri = `/AvailableAddOns/${availableAddOnSid}/Extensions`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new AvailableAddOnExtensionPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new AvailableAddOnExtensionPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new AvailableAddOnExtensionPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new AvailableAddOnExtensionPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class AvailableAddOnExtensionPage extends Page_1.default {
/**
* Initialize the AvailableAddOnExtensionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of AvailableAddOnExtensionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new AvailableAddOnExtensionInstance(this._version, payload, this._solution.availableAddOnSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AvailableAddOnExtensionPage = AvailableAddOnExtensionPage;

View File

@@ -0,0 +1,462 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import Marketplace from "../Marketplace";
import { ApiResponse } from "../../../base/ApiResponse";
import { InstalledAddOnExtensionListInstance } from "./installedAddOn/installedAddOnExtension";
/**
* Options to pass to update a InstalledAddOnInstance
*/
export interface InstalledAddOnContextUpdateOptions {
/** Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured */
configuration?: any;
/** An application-defined string that uniquely identifies the resource. This value must be unique within the Account. */
uniqueName?: string;
}
/**
* Options to pass to create a InstalledAddOnInstance
*/
export interface InstalledAddOnListInstanceCreateOptions {
/** The SID of the AvaliableAddOn to install. */
availableAddOnSid: string;
/** Whether the Terms of Service were accepted. */
acceptTermsOfService: boolean;
/** The JSON object that represents the configuration of the new Add-on being installed. */
configuration?: any;
/** An application-defined string that uniquely identifies the resource. This value must be unique within the Account. */
uniqueName?: string;
}
/**
* Options to pass to each
*/
export interface InstalledAddOnListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface InstalledAddOnListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface InstalledAddOnListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface InstalledAddOnContext {
extensions: InstalledAddOnExtensionListInstance;
/**
* Remove a InstalledAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a InstalledAddOnInstance 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 InstalledAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance
*/
fetch(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>;
/**
* Fetch a InstalledAddOnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any): Promise<ApiResponse<InstalledAddOnInstance>>;
/**
* Update a InstalledAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance
*/
update(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>;
/**
* Update a InstalledAddOnInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance
*/
update(params: InstalledAddOnContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>;
/**
* Update a InstalledAddOnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any): Promise<ApiResponse<InstalledAddOnInstance>>;
/**
* Update a InstalledAddOnInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance with HTTP metadata
*/
updateWithHttpInfo(params: InstalledAddOnContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any): Promise<ApiResponse<InstalledAddOnInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface InstalledAddOnContextSolution {
sid: string;
}
export declare class InstalledAddOnContextImpl implements InstalledAddOnContext {
protected _version: Marketplace;
protected _solution: InstalledAddOnContextSolution;
protected _uri: string;
protected _extensions?: InstalledAddOnExtensionListInstance;
constructor(_version: Marketplace, sid: string);
get extensions(): InstalledAddOnExtensionListInstance;
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?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any): Promise<ApiResponse<InstalledAddOnInstance>>;
update(params?: InstalledAddOnContextUpdateOptions | ((error: Error | null, item?: InstalledAddOnInstance) => any), callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>;
updateWithHttpInfo(params?: InstalledAddOnContextUpdateOptions | ((error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any): Promise<ApiResponse<InstalledAddOnInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): InstalledAddOnContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface InstalledAddOnPayload extends TwilioResponsePayload {
installed_add_ons: InstalledAddOnResource[];
}
interface InstalledAddOnResource {
sid: string;
account_sid: string;
friendly_name: string;
description: string;
configuration: any;
unique_name: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class InstalledAddOnInstance {
protected _version: Marketplace;
protected _solution: InstalledAddOnContextSolution;
protected _context?: InstalledAddOnContext;
constructor(_version: Marketplace, payload: InstalledAddOnResource, sid?: string);
/**
* The unique string that we created to identify the InstalledAddOn resource. This Sid can also be found in the Console on that specific Add-ons page as the \'Available Add-on Sid\'.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the InstalledAddOn resource.
*/
accountSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* A short description of the Add-on\'s functionality.
*/
description: string;
/**
* The JSON object that represents the current configuration of installed Add-on.
*/
configuration: any;
/**
* An application-defined string that uniquely identifies the resource.
*/
uniqueName: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of related resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Remove a InstalledAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a InstalledAddOnInstance 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 InstalledAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance
*/
fetch(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>;
/**
* Fetch a InstalledAddOnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any): Promise<ApiResponse<InstalledAddOnInstance>>;
/**
* Update a InstalledAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance
*/
update(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>;
/**
* Update a InstalledAddOnInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance
*/
update(params: InstalledAddOnContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>;
/**
* Update a InstalledAddOnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any): Promise<ApiResponse<InstalledAddOnInstance>>;
/**
* Update a InstalledAddOnInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance with HTTP metadata
*/
updateWithHttpInfo(params: InstalledAddOnContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any): Promise<ApiResponse<InstalledAddOnInstance>>;
/**
* Access the extensions.
*/
extensions(): InstalledAddOnExtensionListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
friendlyName: string;
description: string;
configuration: any;
uniqueName: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface InstalledAddOnSolution {
}
export interface InstalledAddOnListInstance {
_version: Marketplace;
_solution: InstalledAddOnSolution;
_uri: string;
(sid: string): InstalledAddOnContext;
get(sid: string): InstalledAddOnContext;
/**
* Create a InstalledAddOnInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance
*/
create(params: InstalledAddOnListInstanceCreateOptions, callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>;
/**
* Create a InstalledAddOnInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance with HTTP metadata
*/
createWithHttpInfo(params: InstalledAddOnListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnInstance>) => any): Promise<ApiResponse<InstalledAddOnInstance>>;
/**
* Streams InstalledAddOnInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void): void;
each(params: InstalledAddOnListInstanceEachOptions, callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void): void;
/**
* Streams InstalledAddOnInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: InstalledAddOnListInstanceEachOptions, callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of InstalledAddOnInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: InstalledAddOnPage) => any): Promise<InstalledAddOnPage>;
/**
* Retrieve a single target page of InstalledAddOnInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<InstalledAddOnPage>) => any): Promise<ApiResponse<InstalledAddOnPage>>;
/**
* Lists InstalledAddOnInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: InstalledAddOnInstance[]) => any): Promise<InstalledAddOnInstance[]>;
list(params: InstalledAddOnListInstanceOptions, callback?: (error: Error | null, items: InstalledAddOnInstance[]) => any): Promise<InstalledAddOnInstance[]>;
/**
* Lists InstalledAddOnInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<InstalledAddOnInstance[]>) => any): Promise<ApiResponse<InstalledAddOnInstance[]>>;
listWithHttpInfo(params: InstalledAddOnListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<InstalledAddOnInstance[]>) => any): Promise<ApiResponse<InstalledAddOnInstance[]>>;
/**
* Retrieve a single page of InstalledAddOnInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: InstalledAddOnPage) => any): Promise<InstalledAddOnPage>;
page(params: InstalledAddOnListInstancePageOptions, callback?: (error: Error | null, items: InstalledAddOnPage) => any): Promise<InstalledAddOnPage>;
/**
* Retrieve a single page of InstalledAddOnInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<InstalledAddOnPage>) => any): Promise<ApiResponse<InstalledAddOnPage>>;
pageWithHttpInfo(params: InstalledAddOnListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<InstalledAddOnPage>) => any): Promise<ApiResponse<InstalledAddOnPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function InstalledAddOnListInstance(version: Marketplace): InstalledAddOnListInstance;
export declare class InstalledAddOnPage extends Page<Marketplace, InstalledAddOnPayload, InstalledAddOnResource, InstalledAddOnInstance> {
/**
* Initialize the InstalledAddOnPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: Marketplace, response: Response<string>, solution: InstalledAddOnSolution);
/**
* Build an instance of InstalledAddOnInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: InstalledAddOnResource): InstalledAddOnInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,464 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstalledAddOnPage = exports.InstalledAddOnInstance = exports.InstalledAddOnContextImpl = void 0;
exports.InstalledAddOnListInstance = InstalledAddOnListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const installedAddOnExtension_1 = require("./installedAddOn/installedAddOnExtension");
class InstalledAddOnContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/InstalledAddOns/${sid}`;
}
get extensions() {
this._extensions =
this._extensions ||
(0, installedAddOnExtension_1.InstalledAddOnExtensionListInstance)(this._version, this._solution.sid);
return this._extensions;
}
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 InstalledAddOnInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new InstalledAddOnInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["configuration"] !== undefined)
data["Configuration"] = serialize.object(params["configuration"]);
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new InstalledAddOnInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["configuration"] !== undefined)
data["Configuration"] = serialize.object(params["configuration"]);
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new InstalledAddOnInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.InstalledAddOnContextImpl = InstalledAddOnContextImpl;
class InstalledAddOnInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.description = payload.description;
this.configuration = payload.configuration;
this.uniqueName = payload.unique_name;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new InstalledAddOnContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a InstalledAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a InstalledAddOnInstance 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 InstalledAddOnInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a InstalledAddOnInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the extensions.
*/
extensions() {
return this._proxy.extensions;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
description: this.description,
configuration: this.configuration,
uniqueName: this.uniqueName,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.InstalledAddOnInstance = InstalledAddOnInstance;
function InstalledAddOnListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new InstalledAddOnContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/InstalledAddOns`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["availableAddOnSid"] === null ||
params["availableAddOnSid"] === undefined) {
throw new Error("Required parameter \"params['availableAddOnSid']\" missing.");
}
if (params["acceptTermsOfService"] === null ||
params["acceptTermsOfService"] === undefined) {
throw new Error("Required parameter \"params['acceptTermsOfService']\" missing.");
}
let data = {};
data["AvailableAddOnSid"] = params["availableAddOnSid"];
data["AcceptTermsOfService"] = serialize.bool(params["acceptTermsOfService"]);
if (params["configuration"] !== undefined)
data["Configuration"] = serialize.object(params["configuration"]);
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new InstalledAddOnInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["availableAddOnSid"] === null ||
params["availableAddOnSid"] === undefined) {
throw new Error("Required parameter \"params['availableAddOnSid']\" missing.");
}
if (params["acceptTermsOfService"] === null ||
params["acceptTermsOfService"] === undefined) {
throw new Error("Required parameter \"params['acceptTermsOfService']\" missing.");
}
let data = {};
data["AvailableAddOnSid"] = params["availableAddOnSid"];
data["AcceptTermsOfService"] = serialize.bool(params["acceptTermsOfService"]);
if (params["configuration"] !== undefined)
data["Configuration"] = serialize.object(params["configuration"]);
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new InstalledAddOnInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new InstalledAddOnPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new InstalledAddOnPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new InstalledAddOnPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new InstalledAddOnPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class InstalledAddOnPage extends Page_1.default {
/**
* Initialize the InstalledAddOnPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of InstalledAddOnInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new InstalledAddOnInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.InstalledAddOnPage = InstalledAddOnPage;

View File

@@ -0,0 +1,339 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import Marketplace from "../../Marketplace";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to update a InstalledAddOnExtensionInstance
*/
export interface InstalledAddOnExtensionContextUpdateOptions {
/** Whether the Extension should be invoked. */
enabled: boolean;
}
/**
* Options to pass to each
*/
export interface InstalledAddOnExtensionListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface InstalledAddOnExtensionListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface InstalledAddOnExtensionListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface InstalledAddOnExtensionContext {
/**
* Fetch a InstalledAddOnExtensionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance
*/
fetch(callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>;
/**
* Fetch a InstalledAddOnExtensionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnExtensionInstance>) => any): Promise<ApiResponse<InstalledAddOnExtensionInstance>>;
/**
* Update a InstalledAddOnExtensionInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance
*/
update(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>;
/**
* Update a InstalledAddOnExtensionInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance with HTTP metadata
*/
updateWithHttpInfo(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnExtensionInstance>) => any): Promise<ApiResponse<InstalledAddOnExtensionInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface InstalledAddOnExtensionContextSolution {
installedAddOnSid: string;
sid: string;
}
export declare class InstalledAddOnExtensionContextImpl implements InstalledAddOnExtensionContext {
protected _version: Marketplace;
protected _solution: InstalledAddOnExtensionContextSolution;
protected _uri: string;
constructor(_version: Marketplace, installedAddOnSid: string, sid: string);
fetch(callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnExtensionInstance>) => any): Promise<ApiResponse<InstalledAddOnExtensionInstance>>;
update(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>;
updateWithHttpInfo(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnExtensionInstance>) => any): Promise<ApiResponse<InstalledAddOnExtensionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): InstalledAddOnExtensionContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface InstalledAddOnExtensionPayload extends TwilioResponsePayload {
extensions: InstalledAddOnExtensionResource[];
}
interface InstalledAddOnExtensionResource {
sid: string;
installed_add_on_sid: string;
friendly_name: string;
product_name: string;
unique_name: string;
enabled: boolean;
url: string;
}
export declare class InstalledAddOnExtensionInstance {
protected _version: Marketplace;
protected _solution: InstalledAddOnExtensionContextSolution;
protected _context?: InstalledAddOnExtensionContext;
constructor(_version: Marketplace, payload: InstalledAddOnExtensionResource, installedAddOnSid: string, sid?: string);
/**
* The unique string that we created to identify the InstalledAddOn Extension resource.
*/
sid: string;
/**
* The SID of the InstalledAddOn resource to which this extension applies.
*/
installedAddOnSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The name of the Product this Extension is used within.
*/
productName: string;
/**
* An application-defined string that uniquely identifies the resource.
*/
uniqueName: string;
/**
* Whether the Extension will be invoked.
*/
enabled: boolean;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a InstalledAddOnExtensionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance
*/
fetch(callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>;
/**
* Fetch a InstalledAddOnExtensionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnExtensionInstance>) => any): Promise<ApiResponse<InstalledAddOnExtensionInstance>>;
/**
* Update a InstalledAddOnExtensionInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance
*/
update(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>;
/**
* Update a InstalledAddOnExtensionInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance with HTTP metadata
*/
updateWithHttpInfo(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<InstalledAddOnExtensionInstance>) => any): Promise<ApiResponse<InstalledAddOnExtensionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
installedAddOnSid: string;
friendlyName: string;
productName: string;
uniqueName: string;
enabled: boolean;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface InstalledAddOnExtensionSolution {
installedAddOnSid: string;
}
export interface InstalledAddOnExtensionListInstance {
_version: Marketplace;
_solution: InstalledAddOnExtensionSolution;
_uri: string;
(sid: string): InstalledAddOnExtensionContext;
get(sid: string): InstalledAddOnExtensionContext;
/**
* Streams InstalledAddOnExtensionInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnExtensionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void): void;
each(params: InstalledAddOnExtensionListInstanceEachOptions, callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void): void;
/**
* Streams InstalledAddOnExtensionInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnExtensionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: InstalledAddOnExtensionListInstanceEachOptions, callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of InstalledAddOnExtensionInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: InstalledAddOnExtensionPage) => any): Promise<InstalledAddOnExtensionPage>;
/**
* Retrieve a single target page of InstalledAddOnExtensionInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<InstalledAddOnExtensionPage>) => any): Promise<ApiResponse<InstalledAddOnExtensionPage>>;
/**
* Lists InstalledAddOnExtensionInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnExtensionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: InstalledAddOnExtensionInstance[]) => any): Promise<InstalledAddOnExtensionInstance[]>;
list(params: InstalledAddOnExtensionListInstanceOptions, callback?: (error: Error | null, items: InstalledAddOnExtensionInstance[]) => any): Promise<InstalledAddOnExtensionInstance[]>;
/**
* Lists InstalledAddOnExtensionInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnExtensionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<InstalledAddOnExtensionInstance[]>) => any): Promise<ApiResponse<InstalledAddOnExtensionInstance[]>>;
listWithHttpInfo(params: InstalledAddOnExtensionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<InstalledAddOnExtensionInstance[]>) => any): Promise<ApiResponse<InstalledAddOnExtensionInstance[]>>;
/**
* Retrieve a single page of InstalledAddOnExtensionInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnExtensionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: InstalledAddOnExtensionPage) => any): Promise<InstalledAddOnExtensionPage>;
page(params: InstalledAddOnExtensionListInstancePageOptions, callback?: (error: Error | null, items: InstalledAddOnExtensionPage) => any): Promise<InstalledAddOnExtensionPage>;
/**
* Retrieve a single page of InstalledAddOnExtensionInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { InstalledAddOnExtensionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<InstalledAddOnExtensionPage>) => any): Promise<ApiResponse<InstalledAddOnExtensionPage>>;
pageWithHttpInfo(params: InstalledAddOnExtensionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<InstalledAddOnExtensionPage>) => any): Promise<ApiResponse<InstalledAddOnExtensionPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function InstalledAddOnExtensionListInstance(version: Marketplace, installedAddOnSid: string): InstalledAddOnExtensionListInstance;
export declare class InstalledAddOnExtensionPage extends Page<Marketplace, InstalledAddOnExtensionPayload, InstalledAddOnExtensionResource, InstalledAddOnExtensionInstance> {
/**
* Initialize the InstalledAddOnExtensionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: Marketplace, response: Response<string>, solution: InstalledAddOnExtensionSolution);
/**
* Build an instance of InstalledAddOnExtensionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: InstalledAddOnExtensionResource): InstalledAddOnExtensionInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,328 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstalledAddOnExtensionPage = exports.InstalledAddOnExtensionInstance = exports.InstalledAddOnExtensionContextImpl = void 0;
exports.InstalledAddOnExtensionListInstance = InstalledAddOnExtensionListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class InstalledAddOnExtensionContextImpl {
constructor(_version, installedAddOnSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(installedAddOnSid)) {
throw new Error("Parameter 'installedAddOnSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { installedAddOnSid, sid };
this._uri = `/InstalledAddOns/${installedAddOnSid}/Extensions/${sid}`;
}
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 InstalledAddOnExtensionInstance(operationVersion, payload, instance._solution.installedAddOnSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new InstalledAddOnExtensionInstance(operationVersion, response.body, instance._solution.installedAddOnSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["enabled"] === null || params["enabled"] === undefined) {
throw new Error("Required parameter \"params['enabled']\" missing.");
}
let data = {};
data["Enabled"] = serialize.bool(params["enabled"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new InstalledAddOnExtensionInstance(operationVersion, payload, instance._solution.installedAddOnSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["enabled"] === null || params["enabled"] === undefined) {
throw new Error("Required parameter \"params['enabled']\" missing.");
}
let data = {};
data["Enabled"] = serialize.bool(params["enabled"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new InstalledAddOnExtensionInstance(operationVersion, response.body, instance._solution.installedAddOnSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.InstalledAddOnExtensionContextImpl = InstalledAddOnExtensionContextImpl;
class InstalledAddOnExtensionInstance {
constructor(_version, payload, installedAddOnSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.installedAddOnSid = payload.installed_add_on_sid;
this.friendlyName = payload.friendly_name;
this.productName = payload.product_name;
this.uniqueName = payload.unique_name;
this.enabled = payload.enabled;
this.url = payload.url;
this._solution = { installedAddOnSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new InstalledAddOnExtensionContextImpl(this._version, this._solution.installedAddOnSid, this._solution.sid);
return this._context;
}
/**
* Fetch a InstalledAddOnExtensionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a InstalledAddOnExtensionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed InstalledAddOnExtensionInstance 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 {
sid: this.sid,
installedAddOnSid: this.installedAddOnSid,
friendlyName: this.friendlyName,
productName: this.productName,
uniqueName: this.uniqueName,
enabled: this.enabled,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.InstalledAddOnExtensionInstance = InstalledAddOnExtensionInstance;
function InstalledAddOnExtensionListInstance(version, installedAddOnSid) {
if (!(0, utility_1.isValidPathParam)(installedAddOnSid)) {
throw new Error("Parameter 'installedAddOnSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new InstalledAddOnExtensionContextImpl(version, installedAddOnSid, sid);
};
instance._version = version;
instance._solution = { installedAddOnSid };
instance._uri = `/InstalledAddOns/${installedAddOnSid}/Extensions`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new InstalledAddOnExtensionPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new InstalledAddOnExtensionPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new InstalledAddOnExtensionPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new InstalledAddOnExtensionPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class InstalledAddOnExtensionPage extends Page_1.default {
/**
* Initialize the InstalledAddOnExtensionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of InstalledAddOnExtensionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new InstalledAddOnExtensionInstance(this._version, payload, this._solution.installedAddOnSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.InstalledAddOnExtensionPage = InstalledAddOnExtensionPage;

View File

@@ -0,0 +1,344 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import Wireless from "../Wireless";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to create a CommandInstance
*/
export interface CommandListInstanceCreateOptions {
/** */
command: string;
/** */
device?: string;
/** */
sim?: string;
/** */
callbackMethod?: string;
/** */
callbackUrl?: string;
/** */
commandMode?: string;
/** */
includeSid?: string;
}
/**
* Options to pass to each
*/
export interface CommandListInstanceEachOptions {
/** */
device?: string;
/** */
sim?: string;
/** */
status?: string;
/** */
direction?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: CommandInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface CommandListInstanceOptions {
/** */
device?: string;
/** */
sim?: string;
/** */
status?: string;
/** */
direction?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface CommandListInstancePageOptions {
/** */
device?: string;
/** */
sim?: string;
/** */
status?: string;
/** */
direction?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface CommandContext {
/**
* Fetch a CommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance
*/
fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>;
/**
* Fetch a CommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CommandInstance>) => any): Promise<ApiResponse<CommandInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CommandContextSolution {
sid: string;
}
export declare class CommandContextImpl implements CommandContext {
protected _version: Wireless;
protected _solution: CommandContextSolution;
protected _uri: string;
constructor(_version: Wireless, sid: string);
fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CommandInstance>) => any): Promise<ApiResponse<CommandInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CommandContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CommandPayload extends TwilioResponsePayload {
commands: CommandResource[];
}
interface CommandResource {
sid: string;
account_sid: string;
device_sid: string;
sim_sid: string;
command: string;
command_mode: string;
status: string;
direction: string;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class CommandInstance {
protected _version: Wireless;
protected _solution: CommandContextSolution;
protected _context?: CommandContext;
constructor(_version: Wireless, payload: CommandResource, sid?: string);
sid: string;
accountSid: string;
deviceSid: string;
simSid: string;
command: string;
commandMode: string;
status: string;
direction: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
private get _proxy();
/**
* Fetch a CommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance
*/
fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>;
/**
* Fetch a CommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CommandInstance>) => any): Promise<ApiResponse<CommandInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
deviceSid: string;
simSid: string;
command: string;
commandMode: string;
status: string;
direction: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CommandSolution {
}
export interface CommandListInstance {
_version: Wireless;
_solution: CommandSolution;
_uri: string;
(sid: string): CommandContext;
get(sid: string): CommandContext;
/**
* Create a CommandInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance
*/
create(params: CommandListInstanceCreateOptions, callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>;
/**
* Create a CommandInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance with HTTP metadata
*/
createWithHttpInfo(params: CommandListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<CommandInstance>) => any): Promise<ApiResponse<CommandInstance>>;
/**
* Streams CommandInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void;
each(params: CommandListInstanceEachOptions, callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CommandInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CommandListInstanceEachOptions, callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CommandInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>;
/**
* Retrieve a single target page of CommandInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<CommandPage>) => any): Promise<ApiResponse<CommandPage>>;
/**
* Lists CommandInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CommandInstance[]) => any): Promise<CommandInstance[]>;
list(params: CommandListInstanceOptions, callback?: (error: Error | null, items: CommandInstance[]) => any): Promise<CommandInstance[]>;
/**
* Lists CommandInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CommandInstance[]>) => any): Promise<ApiResponse<CommandInstance[]>>;
listWithHttpInfo(params: CommandListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CommandInstance[]>) => any): Promise<ApiResponse<CommandInstance[]>>;
/**
* Retrieve a single page of CommandInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>;
page(params: CommandListInstancePageOptions, callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>;
/**
* Retrieve a single page of CommandInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CommandPage>) => any): Promise<ApiResponse<CommandPage>>;
pageWithHttpInfo(params: CommandListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CommandPage>) => any): Promise<ApiResponse<CommandPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CommandListInstance(version: Wireless): CommandListInstance;
export declare class CommandPage extends Page<Wireless, CommandPayload, CommandResource, CommandInstance> {
/**
* Initialize the CommandPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: Wireless, response: Response<string>, solution: CommandSolution);
/**
* Build an instance of CommandInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CommandResource): CommandInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,362 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandPage = exports.CommandInstance = exports.CommandContextImpl = void 0;
exports.CommandListInstance = CommandListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class CommandContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Commands/${sid}`;
}
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 CommandInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new CommandInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CommandContextImpl = CommandContextImpl;
class CommandInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.deviceSid = payload.device_sid;
this.simSid = payload.sim_sid;
this.command = payload.command;
this.commandMode = payload.command_mode;
this.status = payload.status;
this.direction = payload.direction;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new CommandContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a CommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
deviceSid: this.deviceSid,
simSid: this.simSid,
command: this.command,
commandMode: this.commandMode,
status: this.status,
direction: this.direction,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CommandInstance = CommandInstance;
function CommandListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new CommandContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Commands`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["command"] === null || params["command"] === undefined) {
throw new Error("Required parameter \"params['command']\" missing.");
}
let data = {};
data["Command"] = params["command"];
if (params["device"] !== undefined)
data["Device"] = params["device"];
if (params["sim"] !== undefined)
data["Sim"] = params["sim"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["commandMode"] !== undefined)
data["CommandMode"] = params["commandMode"];
if (params["includeSid"] !== undefined)
data["IncludeSid"] = params["includeSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new CommandInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["command"] === null || params["command"] === undefined) {
throw new Error("Required parameter \"params['command']\" missing.");
}
let data = {};
data["Command"] = params["command"];
if (params["device"] !== undefined)
data["Device"] = params["device"];
if (params["sim"] !== undefined)
data["Sim"] = params["sim"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["commandMode"] !== undefined)
data["CommandMode"] = params["commandMode"];
if (params["includeSid"] !== undefined)
data["IncludeSid"] = params["includeSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new CommandInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["device"] !== undefined)
data["Device"] = params["device"];
if (params["sim"] !== undefined)
data["Sim"] = params["sim"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["direction"] !== undefined)
data["Direction"] = params["direction"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new CommandPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new CommandPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["device"] !== undefined)
data["Device"] = params["device"];
if (params["sim"] !== undefined)
data["Sim"] = params["sim"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["direction"] !== undefined)
data["Direction"] = params["direction"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new CommandPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new CommandPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class CommandPage extends Page_1.default {
/**
* Initialize the CommandPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of CommandInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CommandInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CommandPage = CommandPage;

View File

@@ -0,0 +1,464 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import Wireless from "../Wireless";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to update a RatePlanInstance
*/
export interface RatePlanContextUpdateOptions {
/** */
uniqueName?: string;
/** */
friendlyName?: string;
}
/**
* Options to pass to create a RatePlanInstance
*/
export interface RatePlanListInstanceCreateOptions {
/** */
uniqueName?: string;
/** */
friendlyName?: string;
/** */
dataEnabled?: boolean;
/** */
dataLimit?: number;
/** */
dataMetering?: string;
/** */
messagingEnabled?: boolean;
/** */
voiceEnabled?: boolean;
/** */
commandsEnabled?: boolean;
/** */
nationalRoamingEnabled?: boolean;
/** */
internationalRoaming?: Array<string>;
}
/**
* Options to pass to each
*/
export interface RatePlanListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface RatePlanListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface RatePlanListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface RatePlanContext {
/**
* Remove a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a RatePlanInstance 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 RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Fetch a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Update a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
update(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Update a RatePlanInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
update(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Update a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Update a RatePlanInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
updateWithHttpInfo(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface RatePlanContextSolution {
sid: string;
}
export declare class RatePlanContextImpl implements RatePlanContext {
protected _version: Wireless;
protected _solution: RatePlanContextSolution;
protected _uri: string;
constructor(_version: Wireless, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
update(params?: RatePlanContextUpdateOptions | ((error: Error | null, item?: RatePlanInstance) => any), callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
updateWithHttpInfo(params?: RatePlanContextUpdateOptions | ((error: Error | null, item?: ApiResponse<RatePlanInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): RatePlanContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface RatePlanPayload extends TwilioResponsePayload {
rate_plans: RatePlanResource[];
}
interface RatePlanResource {
sid: string;
unique_name: string;
account_sid: string;
friendly_name: string;
data_enabled: boolean;
data_metering: string;
data_limit: number;
messaging_enabled: boolean;
voice_enabled: boolean;
national_roaming_enabled: boolean;
international_roaming: Array<string>;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class RatePlanInstance {
protected _version: Wireless;
protected _solution: RatePlanContextSolution;
protected _context?: RatePlanContext;
constructor(_version: Wireless, payload: RatePlanResource, sid?: string);
sid: string;
uniqueName: string;
accountSid: string;
friendlyName: string;
dataEnabled: boolean;
dataMetering: string;
dataLimit: number;
messagingEnabled: boolean;
voiceEnabled: boolean;
nationalRoamingEnabled: boolean;
internationalRoaming: Array<string>;
dateCreated: Date;
dateUpdated: Date;
url: string;
private get _proxy();
/**
* Remove a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a RatePlanInstance 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 RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Fetch a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Update a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
update(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Update a RatePlanInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
update(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Update a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Update a RatePlanInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
updateWithHttpInfo(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
uniqueName: string;
accountSid: string;
friendlyName: string;
dataEnabled: boolean;
dataMetering: string;
dataLimit: number;
messagingEnabled: boolean;
voiceEnabled: boolean;
nationalRoamingEnabled: boolean;
internationalRoaming: string[];
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface RatePlanSolution {
}
export interface RatePlanListInstance {
_version: Wireless;
_solution: RatePlanSolution;
_uri: string;
(sid: string): RatePlanContext;
get(sid: string): RatePlanContext;
/**
* Create a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
create(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Create a RatePlanInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
create(params: RatePlanListInstanceCreateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Create a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Create a RatePlanInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
createWithHttpInfo(params: RatePlanListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Streams RatePlanInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void;
each(params: RatePlanListInstanceEachOptions, callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void;
/**
* Streams RatePlanInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: RatePlanListInstanceEachOptions, callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of RatePlanInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>;
/**
* Retrieve a single target page of RatePlanInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<RatePlanPage>) => any): Promise<ApiResponse<RatePlanPage>>;
/**
* Lists RatePlanInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: RatePlanInstance[]) => any): Promise<RatePlanInstance[]>;
list(params: RatePlanListInstanceOptions, callback?: (error: Error | null, items: RatePlanInstance[]) => any): Promise<RatePlanInstance[]>;
/**
* Lists RatePlanInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<RatePlanInstance[]>) => any): Promise<ApiResponse<RatePlanInstance[]>>;
listWithHttpInfo(params: RatePlanListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<RatePlanInstance[]>) => any): Promise<ApiResponse<RatePlanInstance[]>>;
/**
* Retrieve a single page of RatePlanInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>;
page(params: RatePlanListInstancePageOptions, callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>;
/**
* Retrieve a single page of RatePlanInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<RatePlanPage>) => any): Promise<ApiResponse<RatePlanPage>>;
pageWithHttpInfo(params: RatePlanListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<RatePlanPage>) => any): Promise<ApiResponse<RatePlanPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function RatePlanListInstance(version: Wireless): RatePlanListInstance;
export declare class RatePlanPage extends Page<Wireless, RatePlanPayload, RatePlanResource, RatePlanInstance> {
/**
* Initialize the RatePlanPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: Wireless, response: Response<string>, solution: RatePlanSolution);
/**
* Build an instance of RatePlanInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: RatePlanResource): RatePlanInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,479 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RatePlanPage = exports.RatePlanInstance = exports.RatePlanContextImpl = void 0;
exports.RatePlanListInstance = RatePlanListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class RatePlanContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/RatePlans/${sid}`;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new RatePlanInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new RatePlanInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new RatePlanInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new RatePlanInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RatePlanContextImpl = RatePlanContextImpl;
class RatePlanInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.uniqueName = payload.unique_name;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.dataEnabled = payload.data_enabled;
this.dataMetering = payload.data_metering;
this.dataLimit = deserialize.integer(payload.data_limit);
this.messagingEnabled = payload.messaging_enabled;
this.voiceEnabled = payload.voice_enabled;
this.nationalRoamingEnabled = payload.national_roaming_enabled;
this.internationalRoaming = payload.international_roaming;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new RatePlanContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a RatePlanInstance 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 RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance 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 {
sid: this.sid,
uniqueName: this.uniqueName,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
dataEnabled: this.dataEnabled,
dataMetering: this.dataMetering,
dataLimit: this.dataLimit,
messagingEnabled: this.messagingEnabled,
voiceEnabled: this.voiceEnabled,
nationalRoamingEnabled: this.nationalRoamingEnabled,
internationalRoaming: this.internationalRoaming,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RatePlanInstance = RatePlanInstance;
function RatePlanListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new RatePlanContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/RatePlans`;
instance.create = function create(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["dataEnabled"] !== undefined)
data["DataEnabled"] = serialize.bool(params["dataEnabled"]);
if (params["dataLimit"] !== undefined)
data["DataLimit"] = params["dataLimit"];
if (params["dataMetering"] !== undefined)
data["DataMetering"] = params["dataMetering"];
if (params["messagingEnabled"] !== undefined)
data["MessagingEnabled"] = serialize.bool(params["messagingEnabled"]);
if (params["voiceEnabled"] !== undefined)
data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]);
if (params["commandsEnabled"] !== undefined)
data["CommandsEnabled"] = serialize.bool(params["commandsEnabled"]);
if (params["nationalRoamingEnabled"] !== undefined)
data["NationalRoamingEnabled"] = serialize.bool(params["nationalRoamingEnabled"]);
if (params["internationalRoaming"] !== undefined)
data["InternationalRoaming"] = serialize.map(params["internationalRoaming"], (e) => e);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new RatePlanInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["dataEnabled"] !== undefined)
data["DataEnabled"] = serialize.bool(params["dataEnabled"]);
if (params["dataLimit"] !== undefined)
data["DataLimit"] = params["dataLimit"];
if (params["dataMetering"] !== undefined)
data["DataMetering"] = params["dataMetering"];
if (params["messagingEnabled"] !== undefined)
data["MessagingEnabled"] = serialize.bool(params["messagingEnabled"]);
if (params["voiceEnabled"] !== undefined)
data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]);
if (params["commandsEnabled"] !== undefined)
data["CommandsEnabled"] = serialize.bool(params["commandsEnabled"]);
if (params["nationalRoamingEnabled"] !== undefined)
data["NationalRoamingEnabled"] = serialize.bool(params["nationalRoamingEnabled"]);
if (params["internationalRoaming"] !== undefined)
data["InternationalRoaming"] = serialize.map(params["internationalRoaming"], (e) => e);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new RatePlanInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new RatePlanPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new RatePlanPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new RatePlanPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new RatePlanPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class RatePlanPage extends Page_1.default {
/**
* Initialize the RatePlanPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of RatePlanInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new RatePlanInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.RatePlanPage = RatePlanPage;

461
node_modules/twilio/lib/rest/preview/wireless/sim.d.ts generated vendored Normal file
View File

@@ -0,0 +1,461 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import Wireless from "../Wireless";
import { ApiResponse } from "../../../base/ApiResponse";
import { UsageListInstance } from "./sim/usage";
/**
* Options to pass to update a SimInstance
*/
export interface SimContextUpdateOptions {
/** */
uniqueName?: string;
/** */
callbackMethod?: string;
/** */
callbackUrl?: string;
/** */
friendlyName?: string;
/** */
ratePlan?: string;
/** */
status?: string;
/** */
commandsCallbackMethod?: string;
/** */
commandsCallbackUrl?: string;
/** */
smsFallbackMethod?: string;
/** */
smsFallbackUrl?: string;
/** */
smsMethod?: string;
/** */
smsUrl?: string;
/** */
voiceFallbackMethod?: string;
/** */
voiceFallbackUrl?: string;
/** */
voiceMethod?: string;
/** */
voiceUrl?: string;
}
/**
* Options to pass to each
*/
export interface SimListInstanceEachOptions {
/** */
status?: string;
/** */
iccid?: string;
/** */
ratePlan?: string;
/** */
eId?: string;
/** */
simRegistrationCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: SimInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface SimListInstanceOptions {
/** */
status?: string;
/** */
iccid?: string;
/** */
ratePlan?: string;
/** */
eId?: string;
/** */
simRegistrationCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface SimListInstancePageOptions {
/** */
status?: string;
/** */
iccid?: string;
/** */
ratePlan?: string;
/** */
eId?: string;
/** */
simRegistrationCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface SimContext {
usage: UsageListInstance;
/**
* Fetch a SimInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance
*/
fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
/**
* Fetch a SimInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
/**
* Update a SimInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance
*/
update(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
/**
* Update a SimInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance
*/
update(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
/**
* Update a SimInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
/**
* Update a SimInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance with HTTP metadata
*/
updateWithHttpInfo(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface SimContextSolution {
sid: string;
}
export declare class SimContextImpl implements SimContext {
protected _version: Wireless;
protected _solution: SimContextSolution;
protected _uri: string;
protected _usage?: UsageListInstance;
constructor(_version: Wireless, sid: string);
get usage(): UsageListInstance;
fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
update(params?: SimContextUpdateOptions | ((error: Error | null, item?: SimInstance) => any), callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
updateWithHttpInfo(params?: SimContextUpdateOptions | ((error: Error | null, item?: ApiResponse<SimInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): SimContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface SimPayload extends TwilioResponsePayload {
sims: SimResource[];
}
interface SimResource {
sid: string;
unique_name: string;
account_sid: string;
rate_plan_sid: string;
friendly_name: string;
iccid: string;
e_id: string;
status: string;
commands_callback_url: string;
commands_callback_method: string;
sms_fallback_method: string;
sms_fallback_url: string;
sms_method: string;
sms_url: string;
voice_fallback_method: string;
voice_fallback_url: string;
voice_method: string;
voice_url: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class SimInstance {
protected _version: Wireless;
protected _solution: SimContextSolution;
protected _context?: SimContext;
constructor(_version: Wireless, payload: SimResource, sid?: string);
sid: string;
uniqueName: string;
accountSid: string;
ratePlanSid: string;
friendlyName: string;
iccid: string;
eId: string;
status: string;
commandsCallbackUrl: string;
commandsCallbackMethod: string;
smsFallbackMethod: string;
smsFallbackUrl: string;
smsMethod: string;
smsUrl: string;
voiceFallbackMethod: string;
voiceFallbackUrl: string;
voiceMethod: string;
voiceUrl: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
private get _proxy();
/**
* Fetch a SimInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance
*/
fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
/**
* Fetch a SimInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
/**
* Update a SimInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance
*/
update(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
/**
* Update a SimInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance
*/
update(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
/**
* Update a SimInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
/**
* Update a SimInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance with HTTP metadata
*/
updateWithHttpInfo(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
/**
* Access the usage.
*/
usage(): UsageListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
uniqueName: string;
accountSid: string;
ratePlanSid: string;
friendlyName: string;
iccid: string;
eId: string;
status: string;
commandsCallbackUrl: string;
commandsCallbackMethod: string;
smsFallbackMethod: string;
smsFallbackUrl: string;
smsMethod: string;
smsUrl: string;
voiceFallbackMethod: string;
voiceFallbackUrl: string;
voiceMethod: string;
voiceUrl: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface SimSolution {
}
export interface SimListInstance {
_version: Wireless;
_solution: SimSolution;
_uri: string;
(sid: string): SimContext;
get(sid: string): SimContext;
/**
* Streams SimInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { SimListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: SimInstance, done: (err?: Error) => void) => void): void;
each(params: SimListInstanceEachOptions, callback?: (item: SimInstance, done: (err?: Error) => void) => void): void;
/**
* Streams SimInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { SimListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: SimInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: SimListInstanceEachOptions, callback?: (item: SimInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of SimInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>;
/**
* Retrieve a single target page of SimInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<SimPage>) => any): Promise<ApiResponse<SimPage>>;
/**
* Lists SimInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { SimListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: SimInstance[]) => any): Promise<SimInstance[]>;
list(params: SimListInstanceOptions, callback?: (error: Error | null, items: SimInstance[]) => any): Promise<SimInstance[]>;
/**
* Lists SimInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { SimListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SimInstance[]>) => any): Promise<ApiResponse<SimInstance[]>>;
listWithHttpInfo(params: SimListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SimInstance[]>) => any): Promise<ApiResponse<SimInstance[]>>;
/**
* Retrieve a single page of SimInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { SimListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>;
page(params: SimListInstancePageOptions, callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>;
/**
* Retrieve a single page of SimInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { SimListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SimPage>) => any): Promise<ApiResponse<SimPage>>;
pageWithHttpInfo(params: SimListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SimPage>) => any): Promise<ApiResponse<SimPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SimListInstance(version: Wireless): SimListInstance;
export declare class SimPage extends Page<Wireless, SimPayload, SimResource, SimInstance> {
/**
* Initialize the SimPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: Wireless, response: Response<string>, solution: SimSolution);
/**
* Build an instance of SimInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: SimResource): SimInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

447
node_modules/twilio/lib/rest/preview/wireless/sim.js generated vendored Normal file
View File

@@ -0,0 +1,447 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SimPage = exports.SimInstance = exports.SimContextImpl = void 0;
exports.SimListInstance = SimListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const usage_1 = require("./sim/usage");
class SimContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Sims/${sid}`;
}
get usage() {
this._usage =
this._usage || (0, usage_1.UsageListInstance)(this._version, this._solution.sid);
return this._usage;
}
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 SimInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new SimInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["ratePlan"] !== undefined)
data["RatePlan"] = params["ratePlan"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["commandsCallbackMethod"] !== undefined)
data["CommandsCallbackMethod"] = params["commandsCallbackMethod"];
if (params["commandsCallbackUrl"] !== undefined)
data["CommandsCallbackUrl"] = params["commandsCallbackUrl"];
if (params["smsFallbackMethod"] !== undefined)
data["SmsFallbackMethod"] = params["smsFallbackMethod"];
if (params["smsFallbackUrl"] !== undefined)
data["SmsFallbackUrl"] = params["smsFallbackUrl"];
if (params["smsMethod"] !== undefined)
data["SmsMethod"] = params["smsMethod"];
if (params["smsUrl"] !== undefined)
data["SmsUrl"] = params["smsUrl"];
if (params["voiceFallbackMethod"] !== undefined)
data["VoiceFallbackMethod"] = params["voiceFallbackMethod"];
if (params["voiceFallbackUrl"] !== undefined)
data["VoiceFallbackUrl"] = params["voiceFallbackUrl"];
if (params["voiceMethod"] !== undefined)
data["VoiceMethod"] = params["voiceMethod"];
if (params["voiceUrl"] !== undefined)
data["VoiceUrl"] = params["voiceUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new SimInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["ratePlan"] !== undefined)
data["RatePlan"] = params["ratePlan"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["commandsCallbackMethod"] !== undefined)
data["CommandsCallbackMethod"] = params["commandsCallbackMethod"];
if (params["commandsCallbackUrl"] !== undefined)
data["CommandsCallbackUrl"] = params["commandsCallbackUrl"];
if (params["smsFallbackMethod"] !== undefined)
data["SmsFallbackMethod"] = params["smsFallbackMethod"];
if (params["smsFallbackUrl"] !== undefined)
data["SmsFallbackUrl"] = params["smsFallbackUrl"];
if (params["smsMethod"] !== undefined)
data["SmsMethod"] = params["smsMethod"];
if (params["smsUrl"] !== undefined)
data["SmsUrl"] = params["smsUrl"];
if (params["voiceFallbackMethod"] !== undefined)
data["VoiceFallbackMethod"] = params["voiceFallbackMethod"];
if (params["voiceFallbackUrl"] !== undefined)
data["VoiceFallbackUrl"] = params["voiceFallbackUrl"];
if (params["voiceMethod"] !== undefined)
data["VoiceMethod"] = params["voiceMethod"];
if (params["voiceUrl"] !== undefined)
data["VoiceUrl"] = params["voiceUrl"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new SimInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SimContextImpl = SimContextImpl;
class SimInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.uniqueName = payload.unique_name;
this.accountSid = payload.account_sid;
this.ratePlanSid = payload.rate_plan_sid;
this.friendlyName = payload.friendly_name;
this.iccid = payload.iccid;
this.eId = payload.e_id;
this.status = payload.status;
this.commandsCallbackUrl = payload.commands_callback_url;
this.commandsCallbackMethod = payload.commands_callback_method;
this.smsFallbackMethod = payload.sms_fallback_method;
this.smsFallbackUrl = payload.sms_fallback_url;
this.smsMethod = payload.sms_method;
this.smsUrl = payload.sms_url;
this.voiceFallbackMethod = payload.voice_fallback_method;
this.voiceFallbackUrl = payload.voice_fallback_url;
this.voiceMethod = payload.voice_method;
this.voiceUrl = payload.voice_url;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context || new SimContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a SimInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a SimInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the usage.
*/
usage() {
return this._proxy.usage;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
uniqueName: this.uniqueName,
accountSid: this.accountSid,
ratePlanSid: this.ratePlanSid,
friendlyName: this.friendlyName,
iccid: this.iccid,
eId: this.eId,
status: this.status,
commandsCallbackUrl: this.commandsCallbackUrl,
commandsCallbackMethod: this.commandsCallbackMethod,
smsFallbackMethod: this.smsFallbackMethod,
smsFallbackUrl: this.smsFallbackUrl,
smsMethod: this.smsMethod,
smsUrl: this.smsUrl,
voiceFallbackMethod: this.voiceFallbackMethod,
voiceFallbackUrl: this.voiceFallbackUrl,
voiceMethod: this.voiceMethod,
voiceUrl: this.voiceUrl,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SimInstance = SimInstance;
function SimListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new SimContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Sims`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["iccid"] !== undefined)
data["Iccid"] = params["iccid"];
if (params["ratePlan"] !== undefined)
data["RatePlan"] = params["ratePlan"];
if (params["eId"] !== undefined)
data["EId"] = params["eId"];
if (params["simRegistrationCode"] !== undefined)
data["SimRegistrationCode"] = params["simRegistrationCode"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new SimPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new SimPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["iccid"] !== undefined)
data["Iccid"] = params["iccid"];
if (params["ratePlan"] !== undefined)
data["RatePlan"] = params["ratePlan"];
if (params["eId"] !== undefined)
data["EId"] = params["eId"];
if (params["simRegistrationCode"] !== undefined)
data["SimRegistrationCode"] = params["simRegistrationCode"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new SimPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new SimPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class SimPage extends Page_1.default {
/**
* Initialize the SimPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of SimInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new SimInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SimPage = SimPage;

View File

@@ -0,0 +1,166 @@
import { inspect, InspectOptions } from "util";
import Wireless from "../../Wireless";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to fetch a UsageInstance
*/
export interface UsageContextFetchOptions {
/** */
end?: string;
/** */
start?: string;
}
export interface UsageContext {
/**
* Fetch a UsageInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsageInstance
*/
fetch(callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>;
/**
* Fetch a UsageInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsageInstance
*/
fetch(params: UsageContextFetchOptions, callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>;
/**
* Fetch a UsageInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsageInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<UsageInstance>) => any): Promise<ApiResponse<UsageInstance>>;
/**
* Fetch a UsageInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsageInstance with HTTP metadata
*/
fetchWithHttpInfo(params: UsageContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<UsageInstance>) => any): Promise<ApiResponse<UsageInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface UsageContextSolution {
simSid: string;
}
export declare class UsageContextImpl implements UsageContext {
protected _version: Wireless;
protected _solution: UsageContextSolution;
protected _uri: string;
constructor(_version: Wireless, simSid: string);
fetch(params?: UsageContextFetchOptions | ((error: Error | null, item?: UsageInstance) => any), callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>;
fetchWithHttpInfo(params?: UsageContextFetchOptions | ((error: Error | null, item?: ApiResponse<UsageInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<UsageInstance>) => any): Promise<ApiResponse<UsageInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): UsageContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface UsageResource {
sim_sid: string;
sim_unique_name: string;
account_sid: string;
period: any;
commands_usage: any;
commands_costs: any;
data_usage: any;
data_costs: any;
url: string;
}
export declare class UsageInstance {
protected _version: Wireless;
protected _solution: UsageContextSolution;
protected _context?: UsageContext;
constructor(_version: Wireless, payload: UsageResource, simSid: string);
simSid: string;
simUniqueName: string;
accountSid: string;
period: any;
commandsUsage: any;
commandsCosts: any;
dataUsage: any;
dataCosts: any;
url: string;
private get _proxy();
/**
* Fetch a UsageInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsageInstance
*/
fetch(callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>;
/**
* Fetch a UsageInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsageInstance
*/
fetch(params: UsageContextFetchOptions, callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>;
/**
* Fetch a UsageInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsageInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<UsageInstance>) => any): Promise<ApiResponse<UsageInstance>>;
/**
* Fetch a UsageInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed UsageInstance with HTTP metadata
*/
fetchWithHttpInfo(params: UsageContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<UsageInstance>) => any): Promise<ApiResponse<UsageInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
simSid: string;
simUniqueName: string;
accountSid: string;
period: any;
commandsUsage: any;
commandsCosts: any;
dataUsage: any;
dataCosts: any;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface UsageSolution {
simSid: string;
}
export interface UsageListInstance {
_version: Wireless;
_solution: UsageSolution;
_uri: string;
(): UsageContext;
get(): UsageContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function UsageListInstance(version: Wireless, simSid: string): UsageListInstance;
export {};

View File

@@ -0,0 +1,169 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Preview
* 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.UsageInstance = exports.UsageContextImpl = void 0;
exports.UsageListInstance = UsageListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class UsageContextImpl {
constructor(_version, simSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(simSid)) {
throw new Error("Parameter 'simSid' is not valid.");
}
this._solution = { simSid };
this._uri = `/Sims/${simSid}/Usage`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["end"] !== undefined)
data["End"] = params["end"];
if (params["start"] !== undefined)
data["Start"] = params["start"];
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 UsageInstance(operationVersion, payload, instance._solution.simSid));
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["end"] !== undefined)
data["End"] = params["end"];
if (params["start"] !== undefined)
data["Start"] = params["start"];
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 UsageInstance(operationVersion, response.body, instance._solution.simSid),
}));
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.UsageContextImpl = UsageContextImpl;
class UsageInstance {
constructor(_version, payload, simSid) {
this._version = _version;
this.simSid = payload.sim_sid;
this.simUniqueName = payload.sim_unique_name;
this.accountSid = payload.account_sid;
this.period = payload.period;
this.commandsUsage = payload.commands_usage;
this.commandsCosts = payload.commands_costs;
this.dataUsage = payload.data_usage;
this.dataCosts = payload.data_costs;
this.url = payload.url;
this._solution = { simSid };
}
get _proxy() {
this._context =
this._context ||
new UsageContextImpl(this._version, this._solution.simSid);
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 {
simSid: this.simSid,
simUniqueName: this.simUniqueName,
accountSid: this.accountSid,
period: this.period,
commandsUsage: this.commandsUsage,
commandsCosts: this.commandsCosts,
dataUsage: this.dataUsage,
dataCosts: this.dataCosts,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.UsageInstance = UsageInstance;
function UsageListInstance(version, simSid) {
if (!(0, utility_1.isValidPathParam)(simSid)) {
throw new Error("Parameter 'simSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new UsageContextImpl(version, simSid);
};
instance._version = version;
instance._solution = { simSid };
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;
}