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

55
node_modules/twilio/lib/rest/supersim/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,55 @@
import SupersimBase from "../SupersimBase";
import Version from "../../base/Version";
import { EsimProfileListInstance } from "./v1/esimProfile";
import { FleetListInstance } from "./v1/fleet";
import { IpCommandListInstance } from "./v1/ipCommand";
import { NetworkListInstance } from "./v1/network";
import { NetworkAccessProfileListInstance } from "./v1/networkAccessProfile";
import { SettingsUpdateListInstance } from "./v1/settingsUpdate";
import { SimListInstance } from "./v1/sim";
import { SmsCommandListInstance } from "./v1/smsCommand";
import { UsageRecordListInstance } from "./v1/usageRecord";
export default class V1 extends Version {
/**
* Initialize the V1 version of Supersim
*
* @param domain - The Twilio (Twilio.Supersim) domain
*/
constructor(domain: SupersimBase);
/** esimProfiles - { Twilio.Supersim.V1.EsimProfileListInstance } resource */
protected _esimProfiles?: EsimProfileListInstance;
/** fleets - { Twilio.Supersim.V1.FleetListInstance } resource */
protected _fleets?: FleetListInstance;
/** ipCommands - { Twilio.Supersim.V1.IpCommandListInstance } resource */
protected _ipCommands?: IpCommandListInstance;
/** networks - { Twilio.Supersim.V1.NetworkListInstance } resource */
protected _networks?: NetworkListInstance;
/** networkAccessProfiles - { Twilio.Supersim.V1.NetworkAccessProfileListInstance } resource */
protected _networkAccessProfiles?: NetworkAccessProfileListInstance;
/** settingsUpdates - { Twilio.Supersim.V1.SettingsUpdateListInstance } resource */
protected _settingsUpdates?: SettingsUpdateListInstance;
/** sims - { Twilio.Supersim.V1.SimListInstance } resource */
protected _sims?: SimListInstance;
/** smsCommands - { Twilio.Supersim.V1.SmsCommandListInstance } resource */
protected _smsCommands?: SmsCommandListInstance;
/** usageRecords - { Twilio.Supersim.V1.UsageRecordListInstance } resource */
protected _usageRecords?: UsageRecordListInstance;
/** Getter for esimProfiles resource */
get esimProfiles(): EsimProfileListInstance;
/** Getter for fleets resource */
get fleets(): FleetListInstance;
/** Getter for ipCommands resource */
get ipCommands(): IpCommandListInstance;
/** Getter for networks resource */
get networks(): NetworkListInstance;
/** Getter for networkAccessProfiles resource */
get networkAccessProfiles(): NetworkAccessProfileListInstance;
/** Getter for settingsUpdates resource */
get settingsUpdates(): SettingsUpdateListInstance;
/** Getter for sims resource */
get sims(): SimListInstance;
/** Getter for smsCommands resource */
get smsCommands(): SmsCommandListInstance;
/** Getter for usageRecords resource */
get usageRecords(): UsageRecordListInstance;
}

86
node_modules/twilio/lib/rest/supersim/V1.js generated vendored Normal file
View File

@@ -0,0 +1,86 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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 esimProfile_1 = require("./v1/esimProfile");
const fleet_1 = require("./v1/fleet");
const ipCommand_1 = require("./v1/ipCommand");
const network_1 = require("./v1/network");
const networkAccessProfile_1 = require("./v1/networkAccessProfile");
const settingsUpdate_1 = require("./v1/settingsUpdate");
const sim_1 = require("./v1/sim");
const smsCommand_1 = require("./v1/smsCommand");
const usageRecord_1 = require("./v1/usageRecord");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Supersim
*
* @param domain - The Twilio (Twilio.Supersim) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for esimProfiles resource */
get esimProfiles() {
this._esimProfiles = this._esimProfiles || (0, esimProfile_1.EsimProfileListInstance)(this);
return this._esimProfiles;
}
/** Getter for fleets resource */
get fleets() {
this._fleets = this._fleets || (0, fleet_1.FleetListInstance)(this);
return this._fleets;
}
/** Getter for ipCommands resource */
get ipCommands() {
this._ipCommands = this._ipCommands || (0, ipCommand_1.IpCommandListInstance)(this);
return this._ipCommands;
}
/** Getter for networks resource */
get networks() {
this._networks = this._networks || (0, network_1.NetworkListInstance)(this);
return this._networks;
}
/** Getter for networkAccessProfiles resource */
get networkAccessProfiles() {
this._networkAccessProfiles =
this._networkAccessProfiles || (0, networkAccessProfile_1.NetworkAccessProfileListInstance)(this);
return this._networkAccessProfiles;
}
/** Getter for settingsUpdates resource */
get settingsUpdates() {
this._settingsUpdates =
this._settingsUpdates || (0, settingsUpdate_1.SettingsUpdateListInstance)(this);
return this._settingsUpdates;
}
/** Getter for sims resource */
get sims() {
this._sims = this._sims || (0, sim_1.SimListInstance)(this);
return this._sims;
}
/** Getter for smsCommands resource */
get smsCommands() {
this._smsCommands = this._smsCommands || (0, smsCommand_1.SmsCommandListInstance)(this);
return this._smsCommands;
}
/** Getter for usageRecords resource */
get usageRecords() {
this._usageRecords = this._usageRecords || (0, usageRecord_1.UsageRecordListInstance)(this);
return this._usageRecords;
}
}
exports.default = V1;

View File

@@ -0,0 +1,400 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* The status of the eSIM Profile. Can be: `new`, `reserving`, `available`, `downloaded`, `installed` or `failed`. See the [eSIM Profile Status Values](https://www.twilio.com/docs/iot/supersim/api/esimprofile-resource#status-values) for a description of each.
*/
export type EsimProfileStatus = "new" | "reserving" | "available" | "downloaded" | "installed" | "failed";
/**
* Options to pass to create a EsimProfileInstance
*/
export interface EsimProfileListInstanceCreateOptions {
/** The URL we should call using the `callback_method` when the status of the eSIM Profile changes. At this stage of the eSIM Profile pilot, the a request to the URL will only be called when the ESimProfile resource changes from `reserving` to `available`. */
callbackUrl?: string;
/** The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. */
callbackMethod?: string;
/** When set to `true`, a value for `Eid` does not need to be provided. Instead, when the eSIM profile is reserved, a matching ID will be generated and returned via the `matching_id` property. This identifies the specific eSIM profile that can be used by any capable device to claim and download the profile. */
generateMatchingId?: boolean;
/** Identifier of the eUICC that will claim the eSIM Profile. */
eid?: string;
}
/**
* Options to pass to each
*/
export interface EsimProfileListInstanceEachOptions {
/** List the eSIM Profiles that have been associated with an EId. */
eid?: string;
/** Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. */
simSid?: string;
/** List the eSIM Profiles that are in a given status. */
status?: EsimProfileStatus;
/** 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: EsimProfileInstance, 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 EsimProfileListInstanceOptions {
/** List the eSIM Profiles that have been associated with an EId. */
eid?: string;
/** Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. */
simSid?: string;
/** List the eSIM Profiles that are in a given status. */
status?: EsimProfileStatus;
/** 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 EsimProfileListInstancePageOptions {
/** List the eSIM Profiles that have been associated with an EId. */
eid?: string;
/** Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. */
simSid?: string;
/** List the eSIM Profiles that are in a given status. */
status?: EsimProfileStatus;
/** 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 EsimProfileContext {
/**
* Fetch a EsimProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance
*/
fetch(callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>;
/**
* Fetch a EsimProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EsimProfileInstance>) => any): Promise<ApiResponse<EsimProfileInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface EsimProfileContextSolution {
sid: string;
}
export declare class EsimProfileContextImpl implements EsimProfileContext {
protected _version: V1;
protected _solution: EsimProfileContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
fetch(callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EsimProfileInstance>) => any): Promise<ApiResponse<EsimProfileInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): EsimProfileContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface EsimProfilePayload extends TwilioResponsePayload {
esim_profiles: EsimProfileResource[];
}
interface EsimProfileResource {
sid: string;
account_sid: string;
iccid: string;
sim_sid: string;
status: EsimProfileStatus;
eid: string;
smdp_plus_address: string;
matching_id: string;
activation_code: string;
error_code: string;
error_message: string;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class EsimProfileInstance {
protected _version: V1;
protected _solution: EsimProfileContextSolution;
protected _context?: EsimProfileContext;
constructor(_version: V1, payload: EsimProfileResource, sid?: string);
/**
* The unique string that we created to identify the eSIM Profile resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the eSIM Profile resource belongs.
*/
accountSid: string;
/**
* The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the Sim resource.
*/
iccid: string;
/**
* The SID of the [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource that this eSIM Profile controls.
*/
simSid: string;
status: EsimProfileStatus;
/**
* Identifier of the eUICC that can claim the eSIM Profile.
*/
eid: string;
/**
* Address of the SM-DP+ server from which the Profile will be downloaded. The URL will appear once the eSIM Profile reaches the status `available`.
*/
smdpPlusAddress: string;
/**
* Unique identifier of the eSIM profile that can be used to identify and download the eSIM profile from the SM-DP+ server. Populated if `generate_matching_id` is set to `true` when creating the eSIM profile reservation.
*/
matchingId: string;
/**
* Combined machine-readable activation code for acquiring an eSIM Profile with the Activation Code download method. Can be used in a QR code to download an eSIM profile.
*/
activationCode: string;
/**
* Code indicating the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state.
*/
errorCode: string;
/**
* Error message describing the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state.
*/
errorMessage: 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 eSIM Profile resource.
*/
url: string;
private get _proxy();
/**
* Fetch a EsimProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance
*/
fetch(callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>;
/**
* Fetch a EsimProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EsimProfileInstance>) => any): Promise<ApiResponse<EsimProfileInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
iccid: string;
simSid: string;
status: EsimProfileStatus;
eid: string;
smdpPlusAddress: string;
matchingId: string;
activationCode: string;
errorCode: string;
errorMessage: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface EsimProfileSolution {
}
export interface EsimProfileListInstance {
_version: V1;
_solution: EsimProfileSolution;
_uri: string;
(sid: string): EsimProfileContext;
get(sid: string): EsimProfileContext;
/**
* Create a EsimProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance
*/
create(callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>;
/**
* Create a EsimProfileInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance
*/
create(params: EsimProfileListInstanceCreateOptions, callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>;
/**
* Create a EsimProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EsimProfileInstance>) => any): Promise<ApiResponse<EsimProfileInstance>>;
/**
* Create a EsimProfileInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance with HTTP metadata
*/
createWithHttpInfo(params: EsimProfileListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<EsimProfileInstance>) => any): Promise<ApiResponse<EsimProfileInstance>>;
/**
* Streams EsimProfileInstance 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 { EsimProfileListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: EsimProfileInstance, done: (err?: Error) => void) => void): void;
each(params: EsimProfileListInstanceEachOptions, callback?: (item: EsimProfileInstance, done: (err?: Error) => void) => void): void;
/**
* Streams EsimProfileInstance 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 { EsimProfileListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: EsimProfileInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: EsimProfileListInstanceEachOptions, callback?: (item: EsimProfileInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of EsimProfileInstance 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: EsimProfilePage) => any): Promise<EsimProfilePage>;
/**
* Retrieve a single target page of EsimProfileInstance 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<EsimProfilePage>) => any): Promise<ApiResponse<EsimProfilePage>>;
/**
* Lists EsimProfileInstance 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 { EsimProfileListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: EsimProfileInstance[]) => any): Promise<EsimProfileInstance[]>;
list(params: EsimProfileListInstanceOptions, callback?: (error: Error | null, items: EsimProfileInstance[]) => any): Promise<EsimProfileInstance[]>;
/**
* Lists EsimProfileInstance 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 { EsimProfileListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EsimProfileInstance[]>) => any): Promise<ApiResponse<EsimProfileInstance[]>>;
listWithHttpInfo(params: EsimProfileListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<EsimProfileInstance[]>) => any): Promise<ApiResponse<EsimProfileInstance[]>>;
/**
* Retrieve a single page of EsimProfileInstance 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 { EsimProfileListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: EsimProfilePage) => any): Promise<EsimProfilePage>;
page(params: EsimProfileListInstancePageOptions, callback?: (error: Error | null, items: EsimProfilePage) => any): Promise<EsimProfilePage>;
/**
* Retrieve a single page of EsimProfileInstance 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 { EsimProfileListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EsimProfilePage>) => any): Promise<ApiResponse<EsimProfilePage>>;
pageWithHttpInfo(params: EsimProfileListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<EsimProfilePage>) => any): Promise<ApiResponse<EsimProfilePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function EsimProfileListInstance(version: V1): EsimProfileListInstance;
export declare class EsimProfilePage extends Page<V1, EsimProfilePayload, EsimProfileResource, EsimProfileInstance> {
/**
* Initialize the EsimProfilePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: EsimProfileSolution);
/**
* Build an instance of EsimProfileInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: EsimProfileResource): EsimProfileInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

356
node_modules/twilio/lib/rest/supersim/v1/esimProfile.js generated vendored Normal file
View File

@@ -0,0 +1,356 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.EsimProfilePage = exports.EsimProfileInstance = exports.EsimProfileContextImpl = void 0;
exports.EsimProfileListInstance = EsimProfileListInstance;
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 EsimProfileContextImpl {
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 = `/ESimProfiles/${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 EsimProfileInstance(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 EsimProfileInstance(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.EsimProfileContextImpl = EsimProfileContextImpl;
class EsimProfileInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.iccid = payload.iccid;
this.simSid = payload.sim_sid;
this.status = payload.status;
this.eid = payload.eid;
this.smdpPlusAddress = payload.smdp_plus_address;
this.matchingId = payload.matching_id;
this.activationCode = payload.activation_code;
this.errorCode = payload.error_code;
this.errorMessage = payload.error_message;
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 EsimProfileContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a EsimProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a EsimProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EsimProfileInstance 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,
iccid: this.iccid,
simSid: this.simSid,
status: this.status,
eid: this.eid,
smdpPlusAddress: this.smdpPlusAddress,
matchingId: this.matchingId,
activationCode: this.activationCode,
errorCode: this.errorCode,
errorMessage: this.errorMessage,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EsimProfileInstance = EsimProfileInstance;
function EsimProfileListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new EsimProfileContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/ESimProfiles`;
instance.create = function create(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["generateMatchingId"] !== undefined)
data["GenerateMatchingId"] = serialize.bool(params["generateMatchingId"]);
if (params["eid"] !== undefined)
data["Eid"] = params["eid"];
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 EsimProfileInstance(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["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["generateMatchingId"] !== undefined)
data["GenerateMatchingId"] = serialize.bool(params["generateMatchingId"]);
if (params["eid"] !== undefined)
data["Eid"] = params["eid"];
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 EsimProfileInstance(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["eid"] !== undefined)
data["Eid"] = params["eid"];
if (params["simSid"] !== undefined)
data["SimSid"] = params["simSid"];
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 EsimProfilePage(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 EsimProfilePage(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["eid"] !== undefined)
data["Eid"] = params["eid"];
if (params["simSid"] !== undefined)
data["SimSid"] = params["simSid"];
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 EsimProfilePage(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 EsimProfilePage(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 EsimProfilePage extends Page_1.default {
/**
* Initialize the EsimProfilePage
*
* @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 EsimProfileInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new EsimProfileInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EsimProfilePage = EsimProfilePage;

477
node_modules/twilio/lib/rest/supersim/v1/fleet.d.ts generated vendored Normal file
View File

@@ -0,0 +1,477 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* The model by which a SIMs usage is metered and billed. Defaults to `payg`.
*/
export type FleetDataMetering = "payg";
/**
* Options to pass to update a FleetInstance
*/
export interface FleetContextUpdateOptions {
/** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */
uniqueName?: string;
/** The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet\\\'s SIMs can connect to. */
networkAccessProfile?: string;
/** The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */
ipCommandsUrl?: string;
/** A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */
ipCommandsMethod?: string;
/** The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */
smsCommandsUrl?: string;
/** A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */
smsCommandsMethod?: string;
/** The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). */
dataLimit?: number;
}
/**
* Options to pass to create a FleetInstance
*/
export interface FleetListInstanceCreateOptions {
/** The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet\\\'s SIMs can connect to. */
networkAccessProfile: string;
/** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */
uniqueName?: string;
/** Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. */
dataEnabled?: boolean;
/** The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). */
dataLimit?: number;
/** The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */
ipCommandsUrl?: string;
/** A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */
ipCommandsMethod?: string;
/** Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`. */
smsCommandsEnabled?: boolean;
/** The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */
smsCommandsUrl?: string;
/** A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */
smsCommandsMethod?: string;
}
/**
* Options to pass to each
*/
export interface FleetListInstanceEachOptions {
/** The SID or unique name of the Network Access Profile that controls which cellular networks the Fleet\'s SIMs can connect to. */
networkAccessProfile?: 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: FleetInstance, 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 FleetListInstanceOptions {
/** The SID or unique name of the Network Access Profile that controls which cellular networks the Fleet\'s SIMs can connect to. */
networkAccessProfile?: 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 FleetListInstancePageOptions {
/** The SID or unique name of the Network Access Profile that controls which cellular networks the Fleet\'s SIMs can connect to. */
networkAccessProfile?: 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 FleetContext {
/**
* Fetch a FleetInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance
*/
fetch(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>;
/**
* Fetch a FleetInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FleetInstance>) => any): Promise<ApiResponse<FleetInstance>>;
/**
* Update a FleetInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance
*/
update(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>;
/**
* Update a FleetInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance
*/
update(params: FleetContextUpdateOptions, callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>;
/**
* Update a FleetInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FleetInstance>) => any): Promise<ApiResponse<FleetInstance>>;
/**
* Update a FleetInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance with HTTP metadata
*/
updateWithHttpInfo(params: FleetContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FleetInstance>) => any): Promise<ApiResponse<FleetInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface FleetContextSolution {
sid: string;
}
export declare class FleetContextImpl implements FleetContext {
protected _version: V1;
protected _solution: FleetContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
fetch(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FleetInstance>) => any): Promise<ApiResponse<FleetInstance>>;
update(params?: FleetContextUpdateOptions | ((error: Error | null, item?: FleetInstance) => any), callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>;
updateWithHttpInfo(params?: FleetContextUpdateOptions | ((error: Error | null, item?: ApiResponse<FleetInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<FleetInstance>) => any): Promise<ApiResponse<FleetInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): FleetContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface FleetPayload extends TwilioResponsePayload {
fleets: FleetResource[];
}
interface FleetResource {
account_sid: string;
sid: string;
unique_name: string;
date_created: Date;
date_updated: Date;
url: string;
data_enabled: boolean;
data_limit: number;
data_metering: FleetDataMetering;
sms_commands_enabled: boolean;
sms_commands_url: string;
sms_commands_method: string;
network_access_profile_sid: string;
ip_commands_url: string;
ip_commands_method: string;
}
export declare class FleetInstance {
protected _version: V1;
protected _solution: FleetContextSolution;
protected _context?: FleetContext;
constructor(_version: V1, payload: FleetResource, sid?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Fleet resource.
*/
accountSid: string;
/**
* The unique string that we created to identify the Fleet resource.
*/
sid: string;
/**
* An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address 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 Fleet resource.
*/
url: string;
/**
* Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`.
*/
dataEnabled: boolean;
/**
* The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 250MB.
*/
dataLimit: number;
dataMetering: FleetDataMetering;
/**
* Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `false`.
*/
smsCommandsEnabled: boolean;
/**
* The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.
*/
smsCommandsUrl: string;
/**
* A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.
*/
smsCommandsMethod: string;
/**
* The SID of the Network Access Profile that controls which cellular networks the Fleet\'s SIMs can connect to.
*/
networkAccessProfileSid: string;
/**
* The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.
*/
ipCommandsUrl: string;
/**
* A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.
*/
ipCommandsMethod: string;
private get _proxy();
/**
* Fetch a FleetInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance
*/
fetch(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>;
/**
* Fetch a FleetInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FleetInstance>) => any): Promise<ApiResponse<FleetInstance>>;
/**
* Update a FleetInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance
*/
update(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>;
/**
* Update a FleetInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance
*/
update(params: FleetContextUpdateOptions, callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>;
/**
* Update a FleetInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FleetInstance>) => any): Promise<ApiResponse<FleetInstance>>;
/**
* Update a FleetInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance with HTTP metadata
*/
updateWithHttpInfo(params: FleetContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FleetInstance>) => any): Promise<ApiResponse<FleetInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
sid: string;
uniqueName: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
dataEnabled: boolean;
dataLimit: number;
dataMetering: "payg";
smsCommandsEnabled: boolean;
smsCommandsUrl: string;
smsCommandsMethod: string;
networkAccessProfileSid: string;
ipCommandsUrl: string;
ipCommandsMethod: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface FleetSolution {
}
export interface FleetListInstance {
_version: V1;
_solution: FleetSolution;
_uri: string;
(sid: string): FleetContext;
get(sid: string): FleetContext;
/**
* Create a FleetInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance
*/
create(params: FleetListInstanceCreateOptions, callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>;
/**
* Create a FleetInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance with HTTP metadata
*/
createWithHttpInfo(params: FleetListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<FleetInstance>) => any): Promise<ApiResponse<FleetInstance>>;
/**
* Streams FleetInstance 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 { FleetListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: FleetInstance, done: (err?: Error) => void) => void): void;
each(params: FleetListInstanceEachOptions, callback?: (item: FleetInstance, done: (err?: Error) => void) => void): void;
/**
* Streams FleetInstance 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 { FleetListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: FleetInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: FleetListInstanceEachOptions, callback?: (item: FleetInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of FleetInstance 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: FleetPage) => any): Promise<FleetPage>;
/**
* Retrieve a single target page of FleetInstance 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<FleetPage>) => any): Promise<ApiResponse<FleetPage>>;
/**
* Lists FleetInstance 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 { FleetListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: FleetInstance[]) => any): Promise<FleetInstance[]>;
list(params: FleetListInstanceOptions, callback?: (error: Error | null, items: FleetInstance[]) => any): Promise<FleetInstance[]>;
/**
* Lists FleetInstance 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 { FleetListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FleetInstance[]>) => any): Promise<ApiResponse<FleetInstance[]>>;
listWithHttpInfo(params: FleetListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<FleetInstance[]>) => any): Promise<ApiResponse<FleetInstance[]>>;
/**
* Retrieve a single page of FleetInstance 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 { FleetListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: FleetPage) => any): Promise<FleetPage>;
page(params: FleetListInstancePageOptions, callback?: (error: Error | null, items: FleetPage) => any): Promise<FleetPage>;
/**
* Retrieve a single page of FleetInstance 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 { FleetListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FleetPage>) => any): Promise<ApiResponse<FleetPage>>;
pageWithHttpInfo(params: FleetListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<FleetPage>) => any): Promise<ApiResponse<FleetPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function FleetListInstance(version: V1): FleetListInstance;
export declare class FleetPage extends Page<V1, FleetPayload, FleetResource, FleetInstance> {
/**
* Initialize the FleetPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: FleetSolution);
/**
* Build an instance of FleetInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: FleetResource): FleetInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

453
node_modules/twilio/lib/rest/supersim/v1/fleet.js generated vendored Normal file
View File

@@ -0,0 +1,453 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.FleetPage = exports.FleetInstance = exports.FleetContextImpl = void 0;
exports.FleetListInstance = FleetListInstance;
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 FleetContextImpl {
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 = `/Fleets/${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 FleetInstance(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 FleetInstance(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["networkAccessProfile"] !== undefined)
data["NetworkAccessProfile"] = params["networkAccessProfile"];
if (params["ipCommandsUrl"] !== undefined)
data["IpCommandsUrl"] = params["ipCommandsUrl"];
if (params["ipCommandsMethod"] !== undefined)
data["IpCommandsMethod"] = params["ipCommandsMethod"];
if (params["smsCommandsUrl"] !== undefined)
data["SmsCommandsUrl"] = params["smsCommandsUrl"];
if (params["smsCommandsMethod"] !== undefined)
data["SmsCommandsMethod"] = params["smsCommandsMethod"];
if (params["dataLimit"] !== undefined)
data["DataLimit"] = params["dataLimit"];
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 FleetInstance(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["networkAccessProfile"] !== undefined)
data["NetworkAccessProfile"] = params["networkAccessProfile"];
if (params["ipCommandsUrl"] !== undefined)
data["IpCommandsUrl"] = params["ipCommandsUrl"];
if (params["ipCommandsMethod"] !== undefined)
data["IpCommandsMethod"] = params["ipCommandsMethod"];
if (params["smsCommandsUrl"] !== undefined)
data["SmsCommandsUrl"] = params["smsCommandsUrl"];
if (params["smsCommandsMethod"] !== undefined)
data["SmsCommandsMethod"] = params["smsCommandsMethod"];
if (params["dataLimit"] !== undefined)
data["DataLimit"] = params["dataLimit"];
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 FleetInstance(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.FleetContextImpl = FleetContextImpl;
class FleetInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.sid = payload.sid;
this.uniqueName = payload.unique_name;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.dataEnabled = payload.data_enabled;
this.dataLimit = deserialize.integer(payload.data_limit);
this.dataMetering = payload.data_metering;
this.smsCommandsEnabled = payload.sms_commands_enabled;
this.smsCommandsUrl = payload.sms_commands_url;
this.smsCommandsMethod = payload.sms_commands_method;
this.networkAccessProfileSid = payload.network_access_profile_sid;
this.ipCommandsUrl = payload.ip_commands_url;
this.ipCommandsMethod = payload.ip_commands_method;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context || new FleetContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a FleetInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a FleetInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FleetInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
sid: this.sid,
uniqueName: this.uniqueName,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
dataEnabled: this.dataEnabled,
dataLimit: this.dataLimit,
dataMetering: this.dataMetering,
smsCommandsEnabled: this.smsCommandsEnabled,
smsCommandsUrl: this.smsCommandsUrl,
smsCommandsMethod: this.smsCommandsMethod,
networkAccessProfileSid: this.networkAccessProfileSid,
ipCommandsUrl: this.ipCommandsUrl,
ipCommandsMethod: this.ipCommandsMethod,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FleetInstance = FleetInstance;
function FleetListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new FleetContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Fleets`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["networkAccessProfile"] === null ||
params["networkAccessProfile"] === undefined) {
throw new Error("Required parameter \"params['networkAccessProfile']\" missing.");
}
let data = {};
data["NetworkAccessProfile"] = params["networkAccessProfile"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["dataEnabled"] !== undefined)
data["DataEnabled"] = serialize.bool(params["dataEnabled"]);
if (params["dataLimit"] !== undefined)
data["DataLimit"] = params["dataLimit"];
if (params["ipCommandsUrl"] !== undefined)
data["IpCommandsUrl"] = params["ipCommandsUrl"];
if (params["ipCommandsMethod"] !== undefined)
data["IpCommandsMethod"] = params["ipCommandsMethod"];
if (params["smsCommandsEnabled"] !== undefined)
data["SmsCommandsEnabled"] = serialize.bool(params["smsCommandsEnabled"]);
if (params["smsCommandsUrl"] !== undefined)
data["SmsCommandsUrl"] = params["smsCommandsUrl"];
if (params["smsCommandsMethod"] !== undefined)
data["SmsCommandsMethod"] = params["smsCommandsMethod"];
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 FleetInstance(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["networkAccessProfile"] === null ||
params["networkAccessProfile"] === undefined) {
throw new Error("Required parameter \"params['networkAccessProfile']\" missing.");
}
let data = {};
data["NetworkAccessProfile"] = params["networkAccessProfile"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["dataEnabled"] !== undefined)
data["DataEnabled"] = serialize.bool(params["dataEnabled"]);
if (params["dataLimit"] !== undefined)
data["DataLimit"] = params["dataLimit"];
if (params["ipCommandsUrl"] !== undefined)
data["IpCommandsUrl"] = params["ipCommandsUrl"];
if (params["ipCommandsMethod"] !== undefined)
data["IpCommandsMethod"] = params["ipCommandsMethod"];
if (params["smsCommandsEnabled"] !== undefined)
data["SmsCommandsEnabled"] = serialize.bool(params["smsCommandsEnabled"]);
if (params["smsCommandsUrl"] !== undefined)
data["SmsCommandsUrl"] = params["smsCommandsUrl"];
if (params["smsCommandsMethod"] !== undefined)
data["SmsCommandsMethod"] = params["smsCommandsMethod"];
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 FleetInstance(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["networkAccessProfile"] !== undefined)
data["NetworkAccessProfile"] = params["networkAccessProfile"];
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 FleetPage(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 FleetPage(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["networkAccessProfile"] !== undefined)
data["NetworkAccessProfile"] = params["networkAccessProfile"];
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 FleetPage(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 FleetPage(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 FleetPage extends Page_1.default {
/**
* Initialize the FleetPage
*
* @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 FleetInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new FleetInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FleetPage = FleetPage;

390
node_modules/twilio/lib/rest/supersim/v1/ipCommand.d.ts generated vendored Normal file
View File

@@ -0,0 +1,390 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Either `to_sim` or `from_sim`. Indicates whether the IP Command resource was sent from or to the Super SIM.
*/
export type IpCommandDirection = "to_sim" | "from_sim";
/**
* Either “text” or “binary”. For an IP Command sent to a Super SIM, `payload_type` is configurable. For an IP Command sent from a Super SIM, `payload_type` is always “binary”.
*/
export type IpCommandPayloadType = "text" | "binary";
/**
* The delivery status of the IP Command. This is one of the following: “queued”, “sent”, “failed” or “received”.
*/
export type IpCommandStatus = "queued" | "sent" | "received" | "failed";
/**
* Options to pass to create a IpCommandInstance
*/
export interface IpCommandListInstanceCreateOptions {
/** The `sid` or `unique_name` of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the IP Command to. */
sim: string;
/** The data that will be sent to the device. The payload cannot exceed 1300 bytes. If the PayloadType is set to text, the payload is encoded in UTF-8. If PayloadType is set to binary, the payload is encoded in Base64. */
payload: string;
/** The device port to which the IP Command will be sent. */
devicePort: number;
/** */
payloadType?: IpCommandPayloadType;
/** The URL we should call using the `callback_method` after we have sent the IP Command. */
callbackUrl?: string;
/** The HTTP method we should use to call `callback_url`. Can be `GET` or `POST`, and the default is `POST`. */
callbackMethod?: string;
}
/**
* Options to pass to each
*/
export interface IpCommandListInstanceEachOptions {
/** The SID or unique name of the Sim resource that IP Command was sent to or from. */
sim?: string;
/** The ICCID of the Sim resource that IP Command was sent to or from. */
simIccid?: string;
/** The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each. */
status?: IpCommandStatus;
/** The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */
direction?: IpCommandDirection;
/** 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: IpCommandInstance, 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 IpCommandListInstanceOptions {
/** The SID or unique name of the Sim resource that IP Command was sent to or from. */
sim?: string;
/** The ICCID of the Sim resource that IP Command was sent to or from. */
simIccid?: string;
/** The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each. */
status?: IpCommandStatus;
/** The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */
direction?: IpCommandDirection;
/** 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 IpCommandListInstancePageOptions {
/** The SID or unique name of the Sim resource that IP Command was sent to or from. */
sim?: string;
/** The ICCID of the Sim resource that IP Command was sent to or from. */
simIccid?: string;
/** The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each. */
status?: IpCommandStatus;
/** The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */
direction?: IpCommandDirection;
/** 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 IpCommandContext {
/**
* Fetch a IpCommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpCommandInstance
*/
fetch(callback?: (error: Error | null, item?: IpCommandInstance) => any): Promise<IpCommandInstance>;
/**
* Fetch a IpCommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpCommandInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<IpCommandInstance>) => any): Promise<ApiResponse<IpCommandInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface IpCommandContextSolution {
sid: string;
}
export declare class IpCommandContextImpl implements IpCommandContext {
protected _version: V1;
protected _solution: IpCommandContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
fetch(callback?: (error: Error | null, item?: IpCommandInstance) => any): Promise<IpCommandInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<IpCommandInstance>) => any): Promise<ApiResponse<IpCommandInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): IpCommandContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface IpCommandPayload extends TwilioResponsePayload {
ip_commands: IpCommandResource[];
}
interface IpCommandResource {
sid: string;
account_sid: string;
sim_sid: string;
sim_iccid: string;
status: IpCommandStatus;
direction: IpCommandDirection;
device_ip: string;
device_port: number;
payload_type: IpCommandPayloadType;
payload: string;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class IpCommandInstance {
protected _version: V1;
protected _solution: IpCommandContextSolution;
protected _context?: IpCommandContext;
constructor(_version: V1, payload: IpCommandResource, sid?: string);
/**
* The unique string that we created to identify the IP Command resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Command resource.
*/
accountSid: string;
/**
* The SID of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from.
*/
simSid: string;
/**
* The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from.
*/
simIccid: string;
status: IpCommandStatus;
direction: IpCommandDirection;
/**
* The IP address of the device that the IP Command was sent to or received from. For an IP Command sent to a Super SIM, `device_ip` starts out as `null`, and once the IP Command is “sent”, the `device_ip` will be filled out. An IP Command sent from a Super SIM have its `device_ip` always set.
*/
deviceIp: string;
/**
* For an IP Command sent to a Super SIM, it would be the destination port of the IP message. For an IP Command sent from a Super SIM, it would be the source port of the IP message.
*/
devicePort: number;
payloadType: IpCommandPayloadType;
/**
* The payload that is carried in the IP/UDP message. The payload can be encoded in either text or binary format. For text payload, UTF-8 encoding must be used. For an IP Command sent to a Super SIM, the payload is appended to the IP/UDP message “as is”. The payload should not exceed 1300 bytes. For an IP Command sent from a Super SIM, the payload from the received IP/UDP message is extracted and sent in binary encoding. For an IP Command sent from a Super SIM, the payload should not exceed 1300 bytes. If it is larger than 1300 bytes, there might be fragmentation on the upstream and the message may appear truncated.
*/
payload: 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 IP Command resource.
*/
url: string;
private get _proxy();
/**
* Fetch a IpCommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpCommandInstance
*/
fetch(callback?: (error: Error | null, item?: IpCommandInstance) => any): Promise<IpCommandInstance>;
/**
* Fetch a IpCommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpCommandInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<IpCommandInstance>) => any): Promise<ApiResponse<IpCommandInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
simSid: string;
simIccid: string;
status: IpCommandStatus;
direction: IpCommandDirection;
deviceIp: string;
devicePort: number;
payloadType: IpCommandPayloadType;
payload: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface IpCommandSolution {
}
export interface IpCommandListInstance {
_version: V1;
_solution: IpCommandSolution;
_uri: string;
(sid: string): IpCommandContext;
get(sid: string): IpCommandContext;
/**
* Create a IpCommandInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpCommandInstance
*/
create(params: IpCommandListInstanceCreateOptions, callback?: (error: Error | null, item?: IpCommandInstance) => any): Promise<IpCommandInstance>;
/**
* Create a IpCommandInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpCommandInstance with HTTP metadata
*/
createWithHttpInfo(params: IpCommandListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<IpCommandInstance>) => any): Promise<ApiResponse<IpCommandInstance>>;
/**
* Streams IpCommandInstance 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 { IpCommandListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: IpCommandInstance, done: (err?: Error) => void) => void): void;
each(params: IpCommandListInstanceEachOptions, callback?: (item: IpCommandInstance, done: (err?: Error) => void) => void): void;
/**
* Streams IpCommandInstance 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 { IpCommandListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: IpCommandInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: IpCommandListInstanceEachOptions, callback?: (item: IpCommandInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of IpCommandInstance 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: IpCommandPage) => any): Promise<IpCommandPage>;
/**
* Retrieve a single target page of IpCommandInstance 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<IpCommandPage>) => any): Promise<ApiResponse<IpCommandPage>>;
/**
* Lists IpCommandInstance 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 { IpCommandListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: IpCommandInstance[]) => any): Promise<IpCommandInstance[]>;
list(params: IpCommandListInstanceOptions, callback?: (error: Error | null, items: IpCommandInstance[]) => any): Promise<IpCommandInstance[]>;
/**
* Lists IpCommandInstance 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 { IpCommandListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<IpCommandInstance[]>) => any): Promise<ApiResponse<IpCommandInstance[]>>;
listWithHttpInfo(params: IpCommandListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<IpCommandInstance[]>) => any): Promise<ApiResponse<IpCommandInstance[]>>;
/**
* Retrieve a single page of IpCommandInstance 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 { IpCommandListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: IpCommandPage) => any): Promise<IpCommandPage>;
page(params: IpCommandListInstancePageOptions, callback?: (error: Error | null, items: IpCommandPage) => any): Promise<IpCommandPage>;
/**
* Retrieve a single page of IpCommandInstance 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 { IpCommandListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<IpCommandPage>) => any): Promise<ApiResponse<IpCommandPage>>;
pageWithHttpInfo(params: IpCommandListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<IpCommandPage>) => any): Promise<ApiResponse<IpCommandPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function IpCommandListInstance(version: V1): IpCommandListInstance;
export declare class IpCommandPage extends Page<V1, IpCommandPayload, IpCommandResource, IpCommandInstance> {
/**
* Initialize the IpCommandPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: IpCommandSolution);
/**
* Build an instance of IpCommandInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: IpCommandResource): IpCommandInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

370
node_modules/twilio/lib/rest/supersim/v1/ipCommand.js generated vendored Normal file
View File

@@ -0,0 +1,370 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.IpCommandPage = exports.IpCommandInstance = exports.IpCommandContextImpl = void 0;
exports.IpCommandListInstance = IpCommandListInstance;
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 IpCommandContextImpl {
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 = `/IpCommands/${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 IpCommandInstance(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 IpCommandInstance(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.IpCommandContextImpl = IpCommandContextImpl;
class IpCommandInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.simSid = payload.sim_sid;
this.simIccid = payload.sim_iccid;
this.status = payload.status;
this.direction = payload.direction;
this.deviceIp = payload.device_ip;
this.devicePort = deserialize.integer(payload.device_port);
this.payloadType = payload.payload_type;
this.payload = payload.payload;
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 IpCommandContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a IpCommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpCommandInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a IpCommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed IpCommandInstance 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,
simSid: this.simSid,
simIccid: this.simIccid,
status: this.status,
direction: this.direction,
deviceIp: this.deviceIp,
devicePort: this.devicePort,
payloadType: this.payloadType,
payload: this.payload,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.IpCommandInstance = IpCommandInstance;
function IpCommandListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new IpCommandContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/IpCommands`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["sim"] === null || params["sim"] === undefined) {
throw new Error("Required parameter \"params['sim']\" missing.");
}
if (params["payload"] === null || params["payload"] === undefined) {
throw new Error("Required parameter \"params['payload']\" missing.");
}
if (params["devicePort"] === null || params["devicePort"] === undefined) {
throw new Error("Required parameter \"params['devicePort']\" missing.");
}
let data = {};
data["Sim"] = params["sim"];
data["Payload"] = params["payload"];
data["DevicePort"] = params["devicePort"];
if (params["payloadType"] !== undefined)
data["PayloadType"] = params["payloadType"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
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 IpCommandInstance(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["sim"] === null || params["sim"] === undefined) {
throw new Error("Required parameter \"params['sim']\" missing.");
}
if (params["payload"] === null || params["payload"] === undefined) {
throw new Error("Required parameter \"params['payload']\" missing.");
}
if (params["devicePort"] === null || params["devicePort"] === undefined) {
throw new Error("Required parameter \"params['devicePort']\" missing.");
}
let data = {};
data["Sim"] = params["sim"];
data["Payload"] = params["payload"];
data["DevicePort"] = params["devicePort"];
if (params["payloadType"] !== undefined)
data["PayloadType"] = params["payloadType"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
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 IpCommandInstance(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["sim"] !== undefined)
data["Sim"] = params["sim"];
if (params["simIccid"] !== undefined)
data["SimIccid"] = params["simIccid"];
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 IpCommandPage(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 IpCommandPage(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["sim"] !== undefined)
data["Sim"] = params["sim"];
if (params["simIccid"] !== undefined)
data["SimIccid"] = params["simIccid"];
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 IpCommandPage(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 IpCommandPage(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 IpCommandPage extends Page_1.default {
/**
* Initialize the IpCommandPage
*
* @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 IpCommandInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new IpCommandInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.IpCommandPage = IpCommandPage;

298
node_modules/twilio/lib/rest/supersim/v1/network.d.ts generated vendored Normal file
View File

@@ -0,0 +1,298 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface NetworkListInstanceEachOptions {
/** The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read. */
isoCountry?: string;
/** The \'mobile country code\' of a country. Network resources with this `mcc` in their `identifiers` will be read. */
mcc?: string;
/** The \'mobile network code\' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read. */
mnc?: 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: NetworkInstance, 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 NetworkListInstanceOptions {
/** The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read. */
isoCountry?: string;
/** The \'mobile country code\' of a country. Network resources with this `mcc` in their `identifiers` will be read. */
mcc?: string;
/** The \'mobile network code\' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read. */
mnc?: 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 NetworkListInstancePageOptions {
/** The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read. */
isoCountry?: string;
/** The \'mobile country code\' of a country. Network resources with this `mcc` in their `identifiers` will be read. */
mcc?: string;
/** The \'mobile network code\' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read. */
mnc?: 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 NetworkContext {
/**
* Fetch a NetworkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkInstance
*/
fetch(callback?: (error: Error | null, item?: NetworkInstance) => any): Promise<NetworkInstance>;
/**
* Fetch a NetworkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkInstance>) => any): Promise<ApiResponse<NetworkInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface NetworkContextSolution {
sid: string;
}
export declare class NetworkContextImpl implements NetworkContext {
protected _version: V1;
protected _solution: NetworkContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
fetch(callback?: (error: Error | null, item?: NetworkInstance) => any): Promise<NetworkInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkInstance>) => any): Promise<ApiResponse<NetworkInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): NetworkContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface NetworkPayload extends TwilioResponsePayload {
networks: NetworkResource[];
}
interface NetworkResource {
sid: string;
friendly_name: string;
url: string;
iso_country: string;
identifiers: Array<any>;
}
export declare class NetworkInstance {
protected _version: V1;
protected _solution: NetworkContextSolution;
protected _context?: NetworkContext;
constructor(_version: V1, payload: NetworkResource, sid?: string);
/**
* The unique string that we created to identify the Network resource.
*/
sid: string;
/**
* A human readable identifier of this resource.
*/
friendlyName: string;
/**
* The absolute URL of the Network resource.
*/
url: string;
/**
* The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource.
*/
isoCountry: string;
/**
* Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource.
*/
identifiers: Array<any>;
private get _proxy();
/**
* Fetch a NetworkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkInstance
*/
fetch(callback?: (error: Error | null, item?: NetworkInstance) => any): Promise<NetworkInstance>;
/**
* Fetch a NetworkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkInstance>) => any): Promise<ApiResponse<NetworkInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
friendlyName: string;
url: string;
isoCountry: string;
identifiers: any[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface NetworkSolution {
}
export interface NetworkListInstance {
_version: V1;
_solution: NetworkSolution;
_uri: string;
(sid: string): NetworkContext;
get(sid: string): NetworkContext;
/**
* Streams NetworkInstance 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 { NetworkListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: NetworkInstance, done: (err?: Error) => void) => void): void;
each(params: NetworkListInstanceEachOptions, callback?: (item: NetworkInstance, done: (err?: Error) => void) => void): void;
/**
* Streams NetworkInstance 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 { NetworkListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: NetworkInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: NetworkListInstanceEachOptions, callback?: (item: NetworkInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of NetworkInstance 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: NetworkPage) => any): Promise<NetworkPage>;
/**
* Retrieve a single target page of NetworkInstance 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<NetworkPage>) => any): Promise<ApiResponse<NetworkPage>>;
/**
* Lists NetworkInstance 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 { NetworkListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: NetworkInstance[]) => any): Promise<NetworkInstance[]>;
list(params: NetworkListInstanceOptions, callback?: (error: Error | null, items: NetworkInstance[]) => any): Promise<NetworkInstance[]>;
/**
* Lists NetworkInstance 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 { NetworkListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<NetworkInstance[]>) => any): Promise<ApiResponse<NetworkInstance[]>>;
listWithHttpInfo(params: NetworkListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<NetworkInstance[]>) => any): Promise<ApiResponse<NetworkInstance[]>>;
/**
* Retrieve a single page of NetworkInstance 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 { NetworkListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: NetworkPage) => any): Promise<NetworkPage>;
page(params: NetworkListInstancePageOptions, callback?: (error: Error | null, items: NetworkPage) => any): Promise<NetworkPage>;
/**
* Retrieve a single page of NetworkInstance 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 { NetworkListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<NetworkPage>) => any): Promise<ApiResponse<NetworkPage>>;
pageWithHttpInfo(params: NetworkListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<NetworkPage>) => any): Promise<ApiResponse<NetworkPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function NetworkListInstance(version: V1): NetworkListInstance;
export declare class NetworkPage extends Page<V1, NetworkPayload, NetworkResource, NetworkInstance> {
/**
* Initialize the NetworkPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: NetworkSolution);
/**
* Build an instance of NetworkInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: NetworkResource): NetworkInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

272
node_modules/twilio/lib/rest/supersim/v1/network.js generated vendored Normal file
View File

@@ -0,0 +1,272 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.NetworkPage = exports.NetworkInstance = exports.NetworkContextImpl = void 0;
exports.NetworkListInstance = NetworkListInstance;
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 NetworkContextImpl {
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 = `/Networks/${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 NetworkInstance(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 NetworkInstance(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.NetworkContextImpl = NetworkContextImpl;
class NetworkInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.friendlyName = payload.friendly_name;
this.url = payload.url;
this.isoCountry = payload.iso_country;
this.identifiers = payload.identifiers;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new NetworkContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a NetworkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a NetworkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
friendlyName: this.friendlyName,
url: this.url,
isoCountry: this.isoCountry,
identifiers: this.identifiers,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.NetworkInstance = NetworkInstance;
function NetworkListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new NetworkContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Networks`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["isoCountry"] !== undefined)
data["IsoCountry"] = params["isoCountry"];
if (params["mcc"] !== undefined)
data["Mcc"] = params["mcc"];
if (params["mnc"] !== undefined)
data["Mnc"] = params["mnc"];
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 NetworkPage(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 NetworkPage(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["isoCountry"] !== undefined)
data["IsoCountry"] = params["isoCountry"];
if (params["mcc"] !== undefined)
data["Mcc"] = params["mcc"];
if (params["mnc"] !== undefined)
data["Mnc"] = params["mnc"];
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 NetworkPage(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 NetworkPage(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 NetworkPage extends Page_1.default {
/**
* Initialize the NetworkPage
*
* @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 NetworkInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new NetworkInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.NetworkPage = NetworkPage;

View File

@@ -0,0 +1,417 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { NetworkAccessProfileNetworkListInstance } from "./networkAccessProfile/networkAccessProfileNetwork";
/**
* Options to pass to update a NetworkAccessProfileInstance
*/
export interface NetworkAccessProfileContextUpdateOptions {
/** The new unique name of the Network Access Profile. */
uniqueName?: string;
}
/**
* Options to pass to create a NetworkAccessProfileInstance
*/
export interface NetworkAccessProfileListInstanceCreateOptions {
/** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */
uniqueName?: string;
/** List of Network SIDs that this Network Access Profile will allow connections to. */
networks?: Array<string>;
}
/**
* Options to pass to each
*/
export interface NetworkAccessProfileListInstanceEachOptions {
/** 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: NetworkAccessProfileInstance, 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 NetworkAccessProfileListInstanceOptions {
/** 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 NetworkAccessProfileListInstancePageOptions {
/** 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 NetworkAccessProfileContext {
networks: NetworkAccessProfileNetworkListInstance;
/**
* Fetch a NetworkAccessProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance
*/
fetch(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
/**
* Fetch a NetworkAccessProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
/**
* Update a NetworkAccessProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance
*/
update(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
/**
* Update a NetworkAccessProfileInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance
*/
update(params: NetworkAccessProfileContextUpdateOptions, callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
/**
* Update a NetworkAccessProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
/**
* Update a NetworkAccessProfileInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance with HTTP metadata
*/
updateWithHttpInfo(params: NetworkAccessProfileContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface NetworkAccessProfileContextSolution {
sid: string;
}
export declare class NetworkAccessProfileContextImpl implements NetworkAccessProfileContext {
protected _version: V1;
protected _solution: NetworkAccessProfileContextSolution;
protected _uri: string;
protected _networks?: NetworkAccessProfileNetworkListInstance;
constructor(_version: V1, sid: string);
get networks(): NetworkAccessProfileNetworkListInstance;
fetch(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
update(params?: NetworkAccessProfileContextUpdateOptions | ((error: Error | null, item?: NetworkAccessProfileInstance) => any), callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
updateWithHttpInfo(params?: NetworkAccessProfileContextUpdateOptions | ((error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): NetworkAccessProfileContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface NetworkAccessProfilePayload extends TwilioResponsePayload {
network_access_profiles: NetworkAccessProfileResource[];
}
interface NetworkAccessProfileResource {
sid: string;
unique_name: string;
account_sid: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class NetworkAccessProfileInstance {
protected _version: V1;
protected _solution: NetworkAccessProfileContextSolution;
protected _context?: NetworkAccessProfileContext;
constructor(_version: V1, payload: NetworkAccessProfileResource, sid?: string);
/**
* The unique string that identifies the Network Access Profile resource.
*/
sid: string;
/**
* An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource.
*/
uniqueName: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Network Access Profile belongs to.
*/
accountSid: 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 Network Access Profile resource.
*/
url: string;
links: Record<string, string>;
private get _proxy();
/**
* Fetch a NetworkAccessProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance
*/
fetch(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
/**
* Fetch a NetworkAccessProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
/**
* Update a NetworkAccessProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance
*/
update(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
/**
* Update a NetworkAccessProfileInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance
*/
update(params: NetworkAccessProfileContextUpdateOptions, callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
/**
* Update a NetworkAccessProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
/**
* Update a NetworkAccessProfileInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance with HTTP metadata
*/
updateWithHttpInfo(params: NetworkAccessProfileContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
/**
* Access the networks.
*/
networks(): NetworkAccessProfileNetworkListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
uniqueName: string;
accountSid: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface NetworkAccessProfileSolution {
}
export interface NetworkAccessProfileListInstance {
_version: V1;
_solution: NetworkAccessProfileSolution;
_uri: string;
(sid: string): NetworkAccessProfileContext;
get(sid: string): NetworkAccessProfileContext;
/**
* Create a NetworkAccessProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance
*/
create(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
/**
* Create a NetworkAccessProfileInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance
*/
create(params: NetworkAccessProfileListInstanceCreateOptions, callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>;
/**
* Create a NetworkAccessProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
/**
* Create a NetworkAccessProfileInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance with HTTP metadata
*/
createWithHttpInfo(params: NetworkAccessProfileListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileInstance>) => any): Promise<ApiResponse<NetworkAccessProfileInstance>>;
/**
* Streams NetworkAccessProfileInstance 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 { NetworkAccessProfileListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: NetworkAccessProfileInstance, done: (err?: Error) => void) => void): void;
each(params: NetworkAccessProfileListInstanceEachOptions, callback?: (item: NetworkAccessProfileInstance, done: (err?: Error) => void) => void): void;
/**
* Streams NetworkAccessProfileInstance 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 { NetworkAccessProfileListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: NetworkAccessProfileInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: NetworkAccessProfileListInstanceEachOptions, callback?: (item: NetworkAccessProfileInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of NetworkAccessProfileInstance 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: NetworkAccessProfilePage) => any): Promise<NetworkAccessProfilePage>;
/**
* Retrieve a single target page of NetworkAccessProfileInstance 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<NetworkAccessProfilePage>) => any): Promise<ApiResponse<NetworkAccessProfilePage>>;
/**
* Lists NetworkAccessProfileInstance 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 { NetworkAccessProfileListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: NetworkAccessProfileInstance[]) => any): Promise<NetworkAccessProfileInstance[]>;
list(params: NetworkAccessProfileListInstanceOptions, callback?: (error: Error | null, items: NetworkAccessProfileInstance[]) => any): Promise<NetworkAccessProfileInstance[]>;
/**
* Lists NetworkAccessProfileInstance 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 { NetworkAccessProfileListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<NetworkAccessProfileInstance[]>) => any): Promise<ApiResponse<NetworkAccessProfileInstance[]>>;
listWithHttpInfo(params: NetworkAccessProfileListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<NetworkAccessProfileInstance[]>) => any): Promise<ApiResponse<NetworkAccessProfileInstance[]>>;
/**
* Retrieve a single page of NetworkAccessProfileInstance 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 { NetworkAccessProfileListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: NetworkAccessProfilePage) => any): Promise<NetworkAccessProfilePage>;
page(params: NetworkAccessProfileListInstancePageOptions, callback?: (error: Error | null, items: NetworkAccessProfilePage) => any): Promise<NetworkAccessProfilePage>;
/**
* Retrieve a single page of NetworkAccessProfileInstance 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 { NetworkAccessProfileListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<NetworkAccessProfilePage>) => any): Promise<ApiResponse<NetworkAccessProfilePage>>;
pageWithHttpInfo(params: NetworkAccessProfileListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<NetworkAccessProfilePage>) => any): Promise<ApiResponse<NetworkAccessProfilePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function NetworkAccessProfileListInstance(version: V1): NetworkAccessProfileListInstance;
export declare class NetworkAccessProfilePage extends Page<V1, NetworkAccessProfilePayload, NetworkAccessProfileResource, NetworkAccessProfileInstance> {
/**
* Initialize the NetworkAccessProfilePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: NetworkAccessProfileSolution);
/**
* Build an instance of NetworkAccessProfileInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: NetworkAccessProfileResource): NetworkAccessProfileInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,397 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.NetworkAccessProfilePage = exports.NetworkAccessProfileInstance = exports.NetworkAccessProfileContextImpl = void 0;
exports.NetworkAccessProfileListInstance = NetworkAccessProfileListInstance;
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 networkAccessProfileNetwork_1 = require("./networkAccessProfile/networkAccessProfileNetwork");
class NetworkAccessProfileContextImpl {
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 = `/NetworkAccessProfiles/${sid}`;
}
get networks() {
this._networks =
this._networks ||
(0, networkAccessProfileNetwork_1.NetworkAccessProfileNetworkListInstance)(this._version, this._solution.sid);
return this._networks;
}
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 NetworkAccessProfileInstance(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 NetworkAccessProfileInstance(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"];
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 NetworkAccessProfileInstance(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"];
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 NetworkAccessProfileInstance(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.NetworkAccessProfileContextImpl = NetworkAccessProfileContextImpl;
class NetworkAccessProfileInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.uniqueName = payload.unique_name;
this.accountSid = payload.account_sid;
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 NetworkAccessProfileContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a NetworkAccessProfileInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a NetworkAccessProfileInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileInstance 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 networks.
*/
networks() {
return this._proxy.networks;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
uniqueName: this.uniqueName,
accountSid: this.accountSid,
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.NetworkAccessProfileInstance = NetworkAccessProfileInstance;
function NetworkAccessProfileListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new NetworkAccessProfileContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/NetworkAccessProfiles`;
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["networks"] !== undefined)
data["Networks"] = serialize.map(params["networks"], (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 NetworkAccessProfileInstance(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["networks"] !== undefined)
data["Networks"] = serialize.map(params["networks"], (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 NetworkAccessProfileInstance(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 NetworkAccessProfilePage(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 NetworkAccessProfilePage(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 NetworkAccessProfilePage(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 NetworkAccessProfilePage(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 NetworkAccessProfilePage extends Page_1.default {
/**
* Initialize the NetworkAccessProfilePage
*
* @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 NetworkAccessProfileInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new NetworkAccessProfileInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.NetworkAccessProfilePage = NetworkAccessProfilePage;

View File

@@ -0,0 +1,347 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to create a NetworkAccessProfileNetworkInstance
*/
export interface NetworkAccessProfileNetworkListInstanceCreateOptions {
/** The SID of the Network resource to be added to the Network Access Profile resource. */
network: string;
}
/**
* Options to pass to each
*/
export interface NetworkAccessProfileNetworkListInstanceEachOptions {
/** 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: NetworkAccessProfileNetworkInstance, 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 NetworkAccessProfileNetworkListInstanceOptions {
/** 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 NetworkAccessProfileNetworkListInstancePageOptions {
/** 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 NetworkAccessProfileNetworkContext {
/**
* Remove a NetworkAccessProfileNetworkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a NetworkAccessProfileNetworkInstance 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 NetworkAccessProfileNetworkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileNetworkInstance
*/
fetch(callback?: (error: Error | null, item?: NetworkAccessProfileNetworkInstance) => any): Promise<NetworkAccessProfileNetworkInstance>;
/**
* Fetch a NetworkAccessProfileNetworkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileNetworkInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileNetworkInstance>) => any): Promise<ApiResponse<NetworkAccessProfileNetworkInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface NetworkAccessProfileNetworkContextSolution {
networkAccessProfileSid: string;
sid: string;
}
export declare class NetworkAccessProfileNetworkContextImpl implements NetworkAccessProfileNetworkContext {
protected _version: V1;
protected _solution: NetworkAccessProfileNetworkContextSolution;
protected _uri: string;
constructor(_version: V1, networkAccessProfileSid: string, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: NetworkAccessProfileNetworkInstance) => any): Promise<NetworkAccessProfileNetworkInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileNetworkInstance>) => any): Promise<ApiResponse<NetworkAccessProfileNetworkInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): NetworkAccessProfileNetworkContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface NetworkAccessProfileNetworkPayload extends TwilioResponsePayload {
networks: NetworkAccessProfileNetworkResource[];
}
interface NetworkAccessProfileNetworkResource {
sid: string;
network_access_profile_sid: string;
friendly_name: string;
iso_country: string;
identifiers: Array<any>;
url: string;
}
export declare class NetworkAccessProfileNetworkInstance {
protected _version: V1;
protected _solution: NetworkAccessProfileNetworkContextSolution;
protected _context?: NetworkAccessProfileNetworkContext;
constructor(_version: V1, payload: NetworkAccessProfileNetworkResource, networkAccessProfileSid: string, sid?: string);
/**
* The unique string that identifies the Network resource.
*/
sid: string;
/**
* The unique string that identifies the Network resource\'s Network Access Profile resource.
*/
networkAccessProfileSid: string;
/**
* A human readable identifier of the Network this resource refers to.
*/
friendlyName: string;
/**
* The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource.
*/
isoCountry: string;
/**
* Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource.
*/
identifiers: Array<any>;
/**
* The absolute URL of the Network resource.
*/
url: string;
private get _proxy();
/**
* Remove a NetworkAccessProfileNetworkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a NetworkAccessProfileNetworkInstance 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 NetworkAccessProfileNetworkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileNetworkInstance
*/
fetch(callback?: (error: Error | null, item?: NetworkAccessProfileNetworkInstance) => any): Promise<NetworkAccessProfileNetworkInstance>;
/**
* Fetch a NetworkAccessProfileNetworkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileNetworkInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileNetworkInstance>) => any): Promise<ApiResponse<NetworkAccessProfileNetworkInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
networkAccessProfileSid: string;
friendlyName: string;
isoCountry: string;
identifiers: any[];
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface NetworkAccessProfileNetworkSolution {
networkAccessProfileSid: string;
}
export interface NetworkAccessProfileNetworkListInstance {
_version: V1;
_solution: NetworkAccessProfileNetworkSolution;
_uri: string;
(sid: string): NetworkAccessProfileNetworkContext;
get(sid: string): NetworkAccessProfileNetworkContext;
/**
* Create a NetworkAccessProfileNetworkInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileNetworkInstance
*/
create(params: NetworkAccessProfileNetworkListInstanceCreateOptions, callback?: (error: Error | null, item?: NetworkAccessProfileNetworkInstance) => any): Promise<NetworkAccessProfileNetworkInstance>;
/**
* Create a NetworkAccessProfileNetworkInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileNetworkInstance with HTTP metadata
*/
createWithHttpInfo(params: NetworkAccessProfileNetworkListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<NetworkAccessProfileNetworkInstance>) => any): Promise<ApiResponse<NetworkAccessProfileNetworkInstance>>;
/**
* Streams NetworkAccessProfileNetworkInstance 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 { NetworkAccessProfileNetworkListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: NetworkAccessProfileNetworkInstance, done: (err?: Error) => void) => void): void;
each(params: NetworkAccessProfileNetworkListInstanceEachOptions, callback?: (item: NetworkAccessProfileNetworkInstance, done: (err?: Error) => void) => void): void;
/**
* Streams NetworkAccessProfileNetworkInstance 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 { NetworkAccessProfileNetworkListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: NetworkAccessProfileNetworkInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: NetworkAccessProfileNetworkListInstanceEachOptions, callback?: (item: NetworkAccessProfileNetworkInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of NetworkAccessProfileNetworkInstance 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: NetworkAccessProfileNetworkPage) => any): Promise<NetworkAccessProfileNetworkPage>;
/**
* Retrieve a single target page of NetworkAccessProfileNetworkInstance 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<NetworkAccessProfileNetworkPage>) => any): Promise<ApiResponse<NetworkAccessProfileNetworkPage>>;
/**
* Lists NetworkAccessProfileNetworkInstance 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 { NetworkAccessProfileNetworkListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: NetworkAccessProfileNetworkInstance[]) => any): Promise<NetworkAccessProfileNetworkInstance[]>;
list(params: NetworkAccessProfileNetworkListInstanceOptions, callback?: (error: Error | null, items: NetworkAccessProfileNetworkInstance[]) => any): Promise<NetworkAccessProfileNetworkInstance[]>;
/**
* Lists NetworkAccessProfileNetworkInstance 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 { NetworkAccessProfileNetworkListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<NetworkAccessProfileNetworkInstance[]>) => any): Promise<ApiResponse<NetworkAccessProfileNetworkInstance[]>>;
listWithHttpInfo(params: NetworkAccessProfileNetworkListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<NetworkAccessProfileNetworkInstance[]>) => any): Promise<ApiResponse<NetworkAccessProfileNetworkInstance[]>>;
/**
* Retrieve a single page of NetworkAccessProfileNetworkInstance 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 { NetworkAccessProfileNetworkListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: NetworkAccessProfileNetworkPage) => any): Promise<NetworkAccessProfileNetworkPage>;
page(params: NetworkAccessProfileNetworkListInstancePageOptions, callback?: (error: Error | null, items: NetworkAccessProfileNetworkPage) => any): Promise<NetworkAccessProfileNetworkPage>;
/**
* Retrieve a single page of NetworkAccessProfileNetworkInstance 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 { NetworkAccessProfileNetworkListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<NetworkAccessProfileNetworkPage>) => any): Promise<ApiResponse<NetworkAccessProfileNetworkPage>>;
pageWithHttpInfo(params: NetworkAccessProfileNetworkListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<NetworkAccessProfileNetworkPage>) => any): Promise<ApiResponse<NetworkAccessProfileNetworkPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function NetworkAccessProfileNetworkListInstance(version: V1, networkAccessProfileSid: string): NetworkAccessProfileNetworkListInstance;
export declare class NetworkAccessProfileNetworkPage extends Page<V1, NetworkAccessProfileNetworkPayload, NetworkAccessProfileNetworkResource, NetworkAccessProfileNetworkInstance> {
/**
* Initialize the NetworkAccessProfileNetworkPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: NetworkAccessProfileNetworkSolution);
/**
* Build an instance of NetworkAccessProfileNetworkInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: NetworkAccessProfileNetworkResource): NetworkAccessProfileNetworkInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,363 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.NetworkAccessProfileNetworkPage = exports.NetworkAccessProfileNetworkInstance = exports.NetworkAccessProfileNetworkContextImpl = void 0;
exports.NetworkAccessProfileNetworkListInstance = NetworkAccessProfileNetworkListInstance;
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 NetworkAccessProfileNetworkContextImpl {
constructor(_version, networkAccessProfileSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(networkAccessProfileSid)) {
throw new Error("Parameter 'networkAccessProfileSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { networkAccessProfileSid, sid };
this._uri = `/NetworkAccessProfiles/${networkAccessProfileSid}/Networks/${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 NetworkAccessProfileNetworkInstance(operationVersion, payload, instance._solution.networkAccessProfileSid, 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 NetworkAccessProfileNetworkInstance(operationVersion, response.body, instance._solution.networkAccessProfileSid, 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.NetworkAccessProfileNetworkContextImpl = NetworkAccessProfileNetworkContextImpl;
class NetworkAccessProfileNetworkInstance {
constructor(_version, payload, networkAccessProfileSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.networkAccessProfileSid = payload.network_access_profile_sid;
this.friendlyName = payload.friendly_name;
this.isoCountry = payload.iso_country;
this.identifiers = payload.identifiers;
this.url = payload.url;
this._solution = { networkAccessProfileSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new NetworkAccessProfileNetworkContextImpl(this._version, this._solution.networkAccessProfileSid, this._solution.sid);
return this._context;
}
/**
* Remove a NetworkAccessProfileNetworkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a NetworkAccessProfileNetworkInstance 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 NetworkAccessProfileNetworkInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileNetworkInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a NetworkAccessProfileNetworkInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed NetworkAccessProfileNetworkInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
networkAccessProfileSid: this.networkAccessProfileSid,
friendlyName: this.friendlyName,
isoCountry: this.isoCountry,
identifiers: this.identifiers,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.NetworkAccessProfileNetworkInstance = NetworkAccessProfileNetworkInstance;
function NetworkAccessProfileNetworkListInstance(version, networkAccessProfileSid) {
if (!(0, utility_1.isValidPathParam)(networkAccessProfileSid)) {
throw new Error("Parameter 'networkAccessProfileSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new NetworkAccessProfileNetworkContextImpl(version, networkAccessProfileSid, sid);
};
instance._version = version;
instance._solution = { networkAccessProfileSid };
instance._uri = `/NetworkAccessProfiles/${networkAccessProfileSid}/Networks`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["network"] === null || params["network"] === undefined) {
throw new Error("Required parameter \"params['network']\" missing.");
}
let data = {};
data["Network"] = params["network"];
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 NetworkAccessProfileNetworkInstance(operationVersion, payload, instance._solution.networkAccessProfileSid));
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["network"] === null || params["network"] === undefined) {
throw new Error("Required parameter \"params['network']\" missing.");
}
let data = {};
data["Network"] = params["network"];
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 NetworkAccessProfileNetworkInstance(operationVersion, response.body, instance._solution.networkAccessProfileSid),
}));
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 NetworkAccessProfileNetworkPage(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 NetworkAccessProfileNetworkPage(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 NetworkAccessProfileNetworkPage(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 NetworkAccessProfileNetworkPage(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 NetworkAccessProfileNetworkPage extends Page_1.default {
/**
* Initialize the NetworkAccessProfileNetworkPage
*
* @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 NetworkAccessProfileNetworkInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new NetworkAccessProfileNetworkInstance(this._version, payload, this._solution.networkAccessProfileSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.NetworkAccessProfileNetworkPage = NetworkAccessProfileNetworkPage;

View File

@@ -0,0 +1,249 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* The Status of this Settings Update. One of `scheduled`, `in-progress`, `successful` or `failed`.
*/
export type SettingsUpdateStatus = "scheduled" | "in-progress" | "successful" | "failed";
/**
* Options to pass to each
*/
export interface SettingsUpdateListInstanceEachOptions {
/** Filter the Settings Updates by a Super SIM\'s SID or UniqueName. */
sim?: string;
/** Filter the Settings Updates by status. Can be `scheduled`, `in-progress`, `successful`, or `failed`. */
status?: SettingsUpdateStatus;
/** 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: SettingsUpdateInstance, 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 SettingsUpdateListInstanceOptions {
/** Filter the Settings Updates by a Super SIM\'s SID or UniqueName. */
sim?: string;
/** Filter the Settings Updates by status. Can be `scheduled`, `in-progress`, `successful`, or `failed`. */
status?: SettingsUpdateStatus;
/** 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 SettingsUpdateListInstancePageOptions {
/** Filter the Settings Updates by a Super SIM\'s SID or UniqueName. */
sim?: string;
/** Filter the Settings Updates by status. Can be `scheduled`, `in-progress`, `successful`, or `failed`. */
status?: SettingsUpdateStatus;
/** 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 SettingsUpdateSolution {
}
export interface SettingsUpdateListInstance {
_version: V1;
_solution: SettingsUpdateSolution;
_uri: string;
/**
* Streams SettingsUpdateInstance 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 { SettingsUpdateListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: SettingsUpdateInstance, done: (err?: Error) => void) => void): void;
each(params: SettingsUpdateListInstanceEachOptions, callback?: (item: SettingsUpdateInstance, done: (err?: Error) => void) => void): void;
/**
* Streams SettingsUpdateInstance 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 { SettingsUpdateListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: SettingsUpdateInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: SettingsUpdateListInstanceEachOptions, callback?: (item: SettingsUpdateInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of SettingsUpdateInstance 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: SettingsUpdatePage) => any): Promise<SettingsUpdatePage>;
/**
* Retrieve a single target page of SettingsUpdateInstance 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<SettingsUpdatePage>) => any): Promise<ApiResponse<SettingsUpdatePage>>;
/**
* Lists SettingsUpdateInstance 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 { SettingsUpdateListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: SettingsUpdateInstance[]) => any): Promise<SettingsUpdateInstance[]>;
list(params: SettingsUpdateListInstanceOptions, callback?: (error: Error | null, items: SettingsUpdateInstance[]) => any): Promise<SettingsUpdateInstance[]>;
/**
* Lists SettingsUpdateInstance 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 { SettingsUpdateListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SettingsUpdateInstance[]>) => any): Promise<ApiResponse<SettingsUpdateInstance[]>>;
listWithHttpInfo(params: SettingsUpdateListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SettingsUpdateInstance[]>) => any): Promise<ApiResponse<SettingsUpdateInstance[]>>;
/**
* Retrieve a single page of SettingsUpdateInstance 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 { SettingsUpdateListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: SettingsUpdatePage) => any): Promise<SettingsUpdatePage>;
page(params: SettingsUpdateListInstancePageOptions, callback?: (error: Error | null, items: SettingsUpdatePage) => any): Promise<SettingsUpdatePage>;
/**
* Retrieve a single page of SettingsUpdateInstance 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 { SettingsUpdateListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SettingsUpdatePage>) => any): Promise<ApiResponse<SettingsUpdatePage>>;
pageWithHttpInfo(params: SettingsUpdateListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SettingsUpdatePage>) => any): Promise<ApiResponse<SettingsUpdatePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SettingsUpdateListInstance(version: V1): SettingsUpdateListInstance;
interface SettingsUpdatePayload extends TwilioResponsePayload {
settings_updates: SettingsUpdateResource[];
}
interface SettingsUpdateResource {
sid: string;
iccid: string;
sim_sid: string;
status: SettingsUpdateStatus;
packages: Array<any>;
date_completed: Date;
date_created: Date;
date_updated: Date;
}
export declare class SettingsUpdateInstance {
protected _version: V1;
constructor(_version: V1, payload: SettingsUpdateResource);
/**
* The unique identifier of this Settings Update.
*/
sid: string;
/**
* The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM.
*/
iccid: string;
/**
* The SID of the Super SIM to which this Settings Update was applied.
*/
simSid: string;
status: SettingsUpdateStatus;
/**
* Array containing the different Settings Packages that will be applied to the SIM after the update completes. Each object within the array indicates the name and the version of the Settings Package that will be on the SIM if the update is successful.
*/
packages: Array<any>;
/**
* The time, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, when the update successfully completed and the new settings were applied to the SIM.
*/
dateCompleted: Date;
/**
* The date that this Settings Update was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date that this Settings Update was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
iccid: string;
simSid: string;
status: SettingsUpdateStatus;
packages: any[];
dateCompleted: Date;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class SettingsUpdatePage extends Page<V1, SettingsUpdatePayload, SettingsUpdateResource, SettingsUpdateInstance> {
/**
* Initialize the SettingsUpdatePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: SettingsUpdateSolution);
/**
* Build an instance of SettingsUpdateInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: SettingsUpdateResource): SettingsUpdateInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,189 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.SettingsUpdatePage = exports.SettingsUpdateInstance = void 0;
exports.SettingsUpdateListInstance = SettingsUpdateListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function SettingsUpdateListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/SettingsUpdates`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["sim"] !== undefined)
data["Sim"] = params["sim"];
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 SettingsUpdatePage(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 SettingsUpdatePage(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["sim"] !== undefined)
data["Sim"] = params["sim"];
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 SettingsUpdatePage(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 SettingsUpdatePage(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 SettingsUpdateInstance {
constructor(_version, payload) {
this._version = _version;
this.sid = payload.sid;
this.iccid = payload.iccid;
this.simSid = payload.sim_sid;
this.status = payload.status;
this.packages = payload.packages;
this.dateCompleted = deserialize.iso8601DateTime(payload.date_completed);
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
iccid: this.iccid,
simSid: this.simSid,
status: this.status,
packages: this.packages,
dateCompleted: this.dateCompleted,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SettingsUpdateInstance = SettingsUpdateInstance;
class SettingsUpdatePage extends Page_1.default {
/**
* Initialize the SettingsUpdatePage
*
* @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 SettingsUpdateInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new SettingsUpdateInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SettingsUpdatePage = SettingsUpdatePage;

457
node_modules/twilio/lib/rest/supersim/v1/sim.d.ts generated vendored Normal file
View File

@@ -0,0 +1,457 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { BillingPeriodListInstance } from "./sim/billingPeriod";
import { SimIpAddressListInstance } from "./sim/simIpAddress";
/**
* The status of the Super SIM. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. See the [Super SIM Status Values](https://www.twilio.com/docs/iot/supersim/api/sim-resource#status-values) for a description of each.
*/
export type SimStatus = "new" | "ready" | "active" | "inactive" | "scheduled";
export type SimStatusUpdate = "ready" | "active" | "inactive";
/**
* Options to pass to update a SimInstance
*/
export interface SimContextUpdateOptions {
/** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */
uniqueName?: string;
/** */
status?: SimStatusUpdate;
/** The SID or unique name of the Fleet to which the SIM resource should be assigned. */
fleet?: string;
/** The URL we should call using the `callback_method` after an asynchronous update has finished. */
callbackUrl?: string;
/** The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. */
callbackMethod?: string;
/** The SID of the Account to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a Subaccount of the requesting Account. Only valid when the Sim resource\\\'s status is new. */
accountSid?: string;
}
/**
* Options to pass to create a SimInstance
*/
export interface SimListInstanceCreateOptions {
/** The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the Super SIM to be added to your Account. */
iccid: string;
/** The 10-digit code required to claim the Super SIM for your Account. */
registrationCode: string;
}
/**
* Options to pass to each
*/
export interface SimListInstanceEachOptions {
/** The status of the Sim resources to read. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. */
status?: SimStatus;
/** The SID or unique name of the Fleet to which a list of Sims are assigned. */
fleet?: string;
/** The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with a Super SIM to filter the list by. Passing this parameter will always return a list containing zero or one SIMs. */
iccid?: 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 {
/** The status of the Sim resources to read. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. */
status?: SimStatus;
/** The SID or unique name of the Fleet to which a list of Sims are assigned. */
fleet?: string;
/** The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with a Super SIM to filter the list by. Passing this parameter will always return a list containing zero or one SIMs. */
iccid?: 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 {
/** The status of the Sim resources to read. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. */
status?: SimStatus;
/** The SID or unique name of the Fleet to which a list of Sims are assigned. */
fleet?: string;
/** The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with a Super SIM to filter the list by. Passing this parameter will always return a list containing zero or one SIMs. */
iccid?: 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 {
billingPeriods: BillingPeriodListInstance;
simIpAddresses: SimIpAddressListInstance;
/**
* 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: V1;
protected _solution: SimContextSolution;
protected _uri: string;
protected _billingPeriods?: BillingPeriodListInstance;
protected _simIpAddresses?: SimIpAddressListInstance;
constructor(_version: V1, sid: string);
get billingPeriods(): BillingPeriodListInstance;
get simIpAddresses(): SimIpAddressListInstance;
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;
iccid: string;
status: SimStatus;
fleet_sid: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class SimInstance {
protected _version: V1;
protected _solution: SimContextSolution;
protected _context?: SimContext;
constructor(_version: V1, payload: SimResource, sid?: string);
/**
* The unique string that identifies the Sim resource.
*/
sid: string;
/**
* An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource.
*/
uniqueName: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Super SIM belongs to.
*/
accountSid: string;
/**
* The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the SIM.
*/
iccid: string;
status: SimStatus;
/**
* The unique ID of the Fleet configured for this SIM.
*/
fleetSid: 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 Sim Resource.
*/
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 billingPeriods.
*/
billingPeriods(): BillingPeriodListInstance;
/**
* Access the simIpAddresses.
*/
simIpAddresses(): SimIpAddressListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
uniqueName: string;
accountSid: string;
iccid: string;
status: SimStatus;
fleetSid: 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: V1;
_solution: SimSolution;
_uri: string;
(sid: string): SimContext;
get(sid: string): SimContext;
/**
* Create a SimInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SimInstance
*/
create(params: SimListInstanceCreateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
/**
* Create 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
*/
createWithHttpInfo(params: SimListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
/**
* 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: V1): SimListInstance;
export declare class SimPage extends Page<V1, SimPayload, SimResource, SimInstance> {
/**
* Initialize the SimPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, 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 {};

449
node_modules/twilio/lib/rest/supersim/v1/sim.js generated vendored Normal file
View File

@@ -0,0 +1,449 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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 billingPeriod_1 = require("./sim/billingPeriod");
const simIpAddress_1 = require("./sim/simIpAddress");
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 billingPeriods() {
this._billingPeriods =
this._billingPeriods ||
(0, billingPeriod_1.BillingPeriodListInstance)(this._version, this._solution.sid);
return this._billingPeriods;
}
get simIpAddresses() {
this._simIpAddresses =
this._simIpAddresses ||
(0, simIpAddress_1.SimIpAddressListInstance)(this._version, this._solution.sid);
return this._simIpAddresses;
}
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["status"] !== undefined)
data["Status"] = params["status"];
if (params["fleet"] !== undefined)
data["Fleet"] = params["fleet"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["accountSid"] !== undefined)
data["AccountSid"] = params["accountSid"];
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["status"] !== undefined)
data["Status"] = params["status"];
if (params["fleet"] !== undefined)
data["Fleet"] = params["fleet"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["accountSid"] !== undefined)
data["AccountSid"] = params["accountSid"];
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.iccid = payload.iccid;
this.status = payload.status;
this.fleetSid = payload.fleet_sid;
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 billingPeriods.
*/
billingPeriods() {
return this._proxy.billingPeriods;
}
/**
* Access the simIpAddresses.
*/
simIpAddresses() {
return this._proxy.simIpAddresses;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
uniqueName: this.uniqueName,
accountSid: this.accountSid,
iccid: this.iccid,
status: this.status,
fleetSid: this.fleetSid,
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.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["iccid"] === null || params["iccid"] === undefined) {
throw new Error("Required parameter \"params['iccid']\" missing.");
}
if (params["registrationCode"] === null ||
params["registrationCode"] === undefined) {
throw new Error("Required parameter \"params['registrationCode']\" missing.");
}
let data = {};
data["Iccid"] = params["iccid"];
data["RegistrationCode"] = params["registrationCode"];
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 SimInstance(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["iccid"] === null || params["iccid"] === undefined) {
throw new Error("Required parameter \"params['iccid']\" missing.");
}
if (params["registrationCode"] === null ||
params["registrationCode"] === undefined) {
throw new Error("Required parameter \"params['registrationCode']\" missing.");
}
let data = {};
data["Iccid"] = params["iccid"];
data["RegistrationCode"] = params["registrationCode"];
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 SimInstance(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["fleet"] !== undefined)
data["Fleet"] = params["fleet"];
if (params["iccid"] !== undefined)
data["Iccid"] = params["iccid"];
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["fleet"] !== undefined)
data["Fleet"] = params["fleet"];
if (params["iccid"] !== undefined)
data["Iccid"] = params["iccid"];
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,238 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* The type of Billing Period. Can be `ready` or `active`.
*/
export type BillingPeriodBpType = "ready" | "active";
/**
* Options to pass to each
*/
export interface BillingPeriodListInstanceEachOptions {
/** 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: BillingPeriodInstance, 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 BillingPeriodListInstanceOptions {
/** 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 BillingPeriodListInstancePageOptions {
/** 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 BillingPeriodSolution {
simSid: string;
}
export interface BillingPeriodListInstance {
_version: V1;
_solution: BillingPeriodSolution;
_uri: string;
/**
* Streams BillingPeriodInstance 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 { BillingPeriodListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: BillingPeriodInstance, done: (err?: Error) => void) => void): void;
each(params: BillingPeriodListInstanceEachOptions, callback?: (item: BillingPeriodInstance, done: (err?: Error) => void) => void): void;
/**
* Streams BillingPeriodInstance 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 { BillingPeriodListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: BillingPeriodInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: BillingPeriodListInstanceEachOptions, callback?: (item: BillingPeriodInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of BillingPeriodInstance 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: BillingPeriodPage) => any): Promise<BillingPeriodPage>;
/**
* Retrieve a single target page of BillingPeriodInstance 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<BillingPeriodPage>) => any): Promise<ApiResponse<BillingPeriodPage>>;
/**
* Lists BillingPeriodInstance 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 { BillingPeriodListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: BillingPeriodInstance[]) => any): Promise<BillingPeriodInstance[]>;
list(params: BillingPeriodListInstanceOptions, callback?: (error: Error | null, items: BillingPeriodInstance[]) => any): Promise<BillingPeriodInstance[]>;
/**
* Lists BillingPeriodInstance 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 { BillingPeriodListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BillingPeriodInstance[]>) => any): Promise<ApiResponse<BillingPeriodInstance[]>>;
listWithHttpInfo(params: BillingPeriodListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<BillingPeriodInstance[]>) => any): Promise<ApiResponse<BillingPeriodInstance[]>>;
/**
* Retrieve a single page of BillingPeriodInstance 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 { BillingPeriodListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: BillingPeriodPage) => any): Promise<BillingPeriodPage>;
page(params: BillingPeriodListInstancePageOptions, callback?: (error: Error | null, items: BillingPeriodPage) => any): Promise<BillingPeriodPage>;
/**
* Retrieve a single page of BillingPeriodInstance 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 { BillingPeriodListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<BillingPeriodPage>) => any): Promise<ApiResponse<BillingPeriodPage>>;
pageWithHttpInfo(params: BillingPeriodListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<BillingPeriodPage>) => any): Promise<ApiResponse<BillingPeriodPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function BillingPeriodListInstance(version: V1, simSid: string): BillingPeriodListInstance;
interface BillingPeriodPayload extends TwilioResponsePayload {
billing_periods: BillingPeriodResource[];
}
interface BillingPeriodResource {
sid: string;
account_sid: string;
sim_sid: string;
start_time: Date;
end_time: Date;
period_type: BillingPeriodBpType;
date_created: Date;
date_updated: Date;
}
export declare class BillingPeriodInstance {
protected _version: V1;
constructor(_version: V1, payload: BillingPeriodResource, simSid: string);
/**
* The SID of the Billing Period.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) the Super SIM belongs to.
*/
accountSid: string;
/**
* The SID of the Super SIM the Billing Period belongs to.
*/
simSid: string;
/**
* The start time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
startTime: Date;
/**
* The end time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
endTime: Date;
periodType: BillingPeriodBpType;
/**
* 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;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
simSid: string;
startTime: Date;
endTime: Date;
periodType: BillingPeriodBpType;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class BillingPeriodPage extends Page<V1, BillingPeriodPayload, BillingPeriodResource, BillingPeriodInstance> {
/**
* Initialize the BillingPeriodPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: BillingPeriodSolution);
/**
* Build an instance of BillingPeriodInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: BillingPeriodResource): BillingPeriodInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,185 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.BillingPeriodPage = exports.BillingPeriodInstance = void 0;
exports.BillingPeriodListInstance = BillingPeriodListInstance;
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 BillingPeriodListInstance(version, simSid) {
if (!(0, utility_1.isValidPathParam)(simSid)) {
throw new Error("Parameter 'simSid' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { simSid };
instance._uri = `/Sims/${simSid}/BillingPeriods`;
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 BillingPeriodPage(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 BillingPeriodPage(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 BillingPeriodPage(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 BillingPeriodPage(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 BillingPeriodInstance {
constructor(_version, payload, simSid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.simSid = payload.sim_sid;
this.startTime = deserialize.iso8601DateTime(payload.start_time);
this.endTime = deserialize.iso8601DateTime(payload.end_time);
this.periodType = payload.period_type;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
simSid: this.simSid,
startTime: this.startTime,
endTime: this.endTime,
periodType: this.periodType,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BillingPeriodInstance = BillingPeriodInstance;
class BillingPeriodPage extends Page_1.default {
/**
* Initialize the BillingPeriodPage
*
* @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 BillingPeriodInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new BillingPeriodInstance(this._version, payload, this._solution.simSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BillingPeriodPage = BillingPeriodPage;

View File

@@ -0,0 +1,202 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* IP address version of the corresponding IP address
*/
export type SimIpAddressIpAddressVersion = "IPv4" | "IPv6";
/**
* Options to pass to each
*/
export interface SimIpAddressListInstanceEachOptions {
/** 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: SimIpAddressInstance, 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 SimIpAddressListInstanceOptions {
/** 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 SimIpAddressListInstancePageOptions {
/** 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 SimIpAddressSolution {
simSid: string;
}
export interface SimIpAddressListInstance {
_version: V1;
_solution: SimIpAddressSolution;
_uri: string;
/**
* Streams SimIpAddressInstance 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 { SimIpAddressListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: SimIpAddressInstance, done: (err?: Error) => void) => void): void;
each(params: SimIpAddressListInstanceEachOptions, callback?: (item: SimIpAddressInstance, done: (err?: Error) => void) => void): void;
/**
* Streams SimIpAddressInstance 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 { SimIpAddressListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: SimIpAddressInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: SimIpAddressListInstanceEachOptions, callback?: (item: SimIpAddressInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of SimIpAddressInstance 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: SimIpAddressPage) => any): Promise<SimIpAddressPage>;
/**
* Retrieve a single target page of SimIpAddressInstance 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<SimIpAddressPage>) => any): Promise<ApiResponse<SimIpAddressPage>>;
/**
* Lists SimIpAddressInstance 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 { SimIpAddressListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: SimIpAddressInstance[]) => any): Promise<SimIpAddressInstance[]>;
list(params: SimIpAddressListInstanceOptions, callback?: (error: Error | null, items: SimIpAddressInstance[]) => any): Promise<SimIpAddressInstance[]>;
/**
* Lists SimIpAddressInstance 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 { SimIpAddressListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SimIpAddressInstance[]>) => any): Promise<ApiResponse<SimIpAddressInstance[]>>;
listWithHttpInfo(params: SimIpAddressListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SimIpAddressInstance[]>) => any): Promise<ApiResponse<SimIpAddressInstance[]>>;
/**
* Retrieve a single page of SimIpAddressInstance 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 { SimIpAddressListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: SimIpAddressPage) => any): Promise<SimIpAddressPage>;
page(params: SimIpAddressListInstancePageOptions, callback?: (error: Error | null, items: SimIpAddressPage) => any): Promise<SimIpAddressPage>;
/**
* Retrieve a single page of SimIpAddressInstance 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 { SimIpAddressListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SimIpAddressPage>) => any): Promise<ApiResponse<SimIpAddressPage>>;
pageWithHttpInfo(params: SimIpAddressListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SimIpAddressPage>) => any): Promise<ApiResponse<SimIpAddressPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SimIpAddressListInstance(version: V1, simSid: string): SimIpAddressListInstance;
interface SimIpAddressPayload extends TwilioResponsePayload {
ip_addresses: SimIpAddressResource[];
}
interface SimIpAddressResource {
ip_address: string;
ip_address_version: SimIpAddressIpAddressVersion;
}
export declare class SimIpAddressInstance {
protected _version: V1;
constructor(_version: V1, payload: SimIpAddressResource, simSid: string);
/**
* IP address assigned to the given Super SIM
*/
ipAddress: string;
ipAddressVersion: SimIpAddressIpAddressVersion;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
ipAddress: string;
ipAddressVersion: SimIpAddressIpAddressVersion;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class SimIpAddressPage extends Page<V1, SimIpAddressPayload, SimIpAddressResource, SimIpAddressInstance> {
/**
* Initialize the SimIpAddressPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: SimIpAddressSolution);
/**
* Build an instance of SimIpAddressInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: SimIpAddressResource): SimIpAddressInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,173 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.SimIpAddressPage = exports.SimIpAddressInstance = void 0;
exports.SimIpAddressListInstance = SimIpAddressListInstance;
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 SimIpAddressListInstance(version, simSid) {
if (!(0, utility_1.isValidPathParam)(simSid)) {
throw new Error("Parameter 'simSid' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { simSid };
instance._uri = `/Sims/${simSid}/IpAddresses`;
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 SimIpAddressPage(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 SimIpAddressPage(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 SimIpAddressPage(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 SimIpAddressPage(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 SimIpAddressInstance {
constructor(_version, payload, simSid) {
this._version = _version;
this.ipAddress = payload.ip_address;
this.ipAddressVersion = payload.ip_address_version;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
ipAddress: this.ipAddress,
ipAddressVersion: this.ipAddressVersion,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SimIpAddressInstance = SimIpAddressInstance;
class SimIpAddressPage extends Page_1.default {
/**
* Initialize the SimIpAddressPage
*
* @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 SimIpAddressInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new SimIpAddressInstance(this._version, payload, this._solution.simSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SimIpAddressPage = SimIpAddressPage;

View File

@@ -0,0 +1,355 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`.
*/
export type SmsCommandDirection = "to_sim" | "from_sim";
/**
* The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/iot/supersim/api/smscommand-resource#status-values) for a description of each.
*/
export type SmsCommandStatus = "queued" | "sent" | "delivered" | "received" | "failed";
/**
* Options to pass to create a SmsCommandInstance
*/
export interface SmsCommandListInstanceCreateOptions {
/** The `sid` or `unique_name` of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the SMS Command to. */
sim: string;
/** The message body of the SMS Command. */
payload: string;
/** The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. */
callbackMethod?: string;
/** The URL we should call using the `callback_method` after we have sent the command. */
callbackUrl?: string;
}
/**
* Options to pass to each
*/
export interface SmsCommandListInstanceEachOptions {
/** The SID or unique name of the Sim resource that SMS Command was sent to or from. */
sim?: string;
/** The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/iot/supersim/api/smscommand-resource#status-values) for a description of each. */
status?: SmsCommandStatus;
/** The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */
direction?: SmsCommandDirection;
/** 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: SmsCommandInstance, 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 SmsCommandListInstanceOptions {
/** The SID or unique name of the Sim resource that SMS Command was sent to or from. */
sim?: string;
/** The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/iot/supersim/api/smscommand-resource#status-values) for a description of each. */
status?: SmsCommandStatus;
/** The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */
direction?: SmsCommandDirection;
/** 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 SmsCommandListInstancePageOptions {
/** The SID or unique name of the Sim resource that SMS Command was sent to or from. */
sim?: string;
/** The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/iot/supersim/api/smscommand-resource#status-values) for a description of each. */
status?: SmsCommandStatus;
/** The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */
direction?: SmsCommandDirection;
/** 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 SmsCommandContext {
/**
* Fetch a SmsCommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SmsCommandInstance
*/
fetch(callback?: (error: Error | null, item?: SmsCommandInstance) => any): Promise<SmsCommandInstance>;
/**
* Fetch a SmsCommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SmsCommandInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SmsCommandInstance>) => any): Promise<ApiResponse<SmsCommandInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface SmsCommandContextSolution {
sid: string;
}
export declare class SmsCommandContextImpl implements SmsCommandContext {
protected _version: V1;
protected _solution: SmsCommandContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
fetch(callback?: (error: Error | null, item?: SmsCommandInstance) => any): Promise<SmsCommandInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SmsCommandInstance>) => any): Promise<ApiResponse<SmsCommandInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): SmsCommandContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface SmsCommandPayload extends TwilioResponsePayload {
sms_commands: SmsCommandResource[];
}
interface SmsCommandResource {
sid: string;
account_sid: string;
sim_sid: string;
payload: string;
status: SmsCommandStatus;
direction: SmsCommandDirection;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class SmsCommandInstance {
protected _version: V1;
protected _solution: SmsCommandContextSolution;
protected _context?: SmsCommandContext;
constructor(_version: V1, payload: SmsCommandResource, sid?: string);
/**
* The unique string that we created to identify the SMS Command resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SMS Command resource.
*/
accountSid: string;
/**
* The SID of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this SMS Command was sent to or from.
*/
simSid: string;
/**
* The message body of the SMS Command sent to or from the SIM. For text mode messages, this can be up to 160 characters.
*/
payload: string;
status: SmsCommandStatus;
direction: SmsCommandDirection;
/**
* 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 SMS Command resource.
*/
url: string;
private get _proxy();
/**
* Fetch a SmsCommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SmsCommandInstance
*/
fetch(callback?: (error: Error | null, item?: SmsCommandInstance) => any): Promise<SmsCommandInstance>;
/**
* Fetch a SmsCommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SmsCommandInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SmsCommandInstance>) => any): Promise<ApiResponse<SmsCommandInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
simSid: string;
payload: string;
status: SmsCommandStatus;
direction: SmsCommandDirection;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface SmsCommandSolution {
}
export interface SmsCommandListInstance {
_version: V1;
_solution: SmsCommandSolution;
_uri: string;
(sid: string): SmsCommandContext;
get(sid: string): SmsCommandContext;
/**
* Create a SmsCommandInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SmsCommandInstance
*/
create(params: SmsCommandListInstanceCreateOptions, callback?: (error: Error | null, item?: SmsCommandInstance) => any): Promise<SmsCommandInstance>;
/**
* Create a SmsCommandInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SmsCommandInstance with HTTP metadata
*/
createWithHttpInfo(params: SmsCommandListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<SmsCommandInstance>) => any): Promise<ApiResponse<SmsCommandInstance>>;
/**
* Streams SmsCommandInstance 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 { SmsCommandListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: SmsCommandInstance, done: (err?: Error) => void) => void): void;
each(params: SmsCommandListInstanceEachOptions, callback?: (item: SmsCommandInstance, done: (err?: Error) => void) => void): void;
/**
* Streams SmsCommandInstance 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 { SmsCommandListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: SmsCommandInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: SmsCommandListInstanceEachOptions, callback?: (item: SmsCommandInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of SmsCommandInstance 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: SmsCommandPage) => any): Promise<SmsCommandPage>;
/**
* Retrieve a single target page of SmsCommandInstance 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<SmsCommandPage>) => any): Promise<ApiResponse<SmsCommandPage>>;
/**
* Lists SmsCommandInstance 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 { SmsCommandListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: SmsCommandInstance[]) => any): Promise<SmsCommandInstance[]>;
list(params: SmsCommandListInstanceOptions, callback?: (error: Error | null, items: SmsCommandInstance[]) => any): Promise<SmsCommandInstance[]>;
/**
* Lists SmsCommandInstance 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 { SmsCommandListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SmsCommandInstance[]>) => any): Promise<ApiResponse<SmsCommandInstance[]>>;
listWithHttpInfo(params: SmsCommandListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SmsCommandInstance[]>) => any): Promise<ApiResponse<SmsCommandInstance[]>>;
/**
* Retrieve a single page of SmsCommandInstance 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 { SmsCommandListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: SmsCommandPage) => any): Promise<SmsCommandPage>;
page(params: SmsCommandListInstancePageOptions, callback?: (error: Error | null, items: SmsCommandPage) => any): Promise<SmsCommandPage>;
/**
* Retrieve a single page of SmsCommandInstance 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 { SmsCommandListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SmsCommandPage>) => any): Promise<ApiResponse<SmsCommandPage>>;
pageWithHttpInfo(params: SmsCommandListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SmsCommandPage>) => any): Promise<ApiResponse<SmsCommandPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SmsCommandListInstance(version: V1): SmsCommandListInstance;
export declare class SmsCommandPage extends Page<V1, SmsCommandPayload, SmsCommandResource, SmsCommandInstance> {
/**
* Initialize the SmsCommandPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: SmsCommandSolution);
/**
* Build an instance of SmsCommandInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: SmsCommandResource): SmsCommandInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

346
node_modules/twilio/lib/rest/supersim/v1/smsCommand.js generated vendored Normal file
View File

@@ -0,0 +1,346 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.SmsCommandPage = exports.SmsCommandInstance = exports.SmsCommandContextImpl = void 0;
exports.SmsCommandListInstance = SmsCommandListInstance;
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 SmsCommandContextImpl {
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 = `/SmsCommands/${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 SmsCommandInstance(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 SmsCommandInstance(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.SmsCommandContextImpl = SmsCommandContextImpl;
class SmsCommandInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.simSid = payload.sim_sid;
this.payload = payload.payload;
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 SmsCommandContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a SmsCommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SmsCommandInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a SmsCommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SmsCommandInstance 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,
simSid: this.simSid,
payload: this.payload,
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.SmsCommandInstance = SmsCommandInstance;
function SmsCommandListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new SmsCommandContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/SmsCommands`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["sim"] === null || params["sim"] === undefined) {
throw new Error("Required parameter \"params['sim']\" missing.");
}
if (params["payload"] === null || params["payload"] === undefined) {
throw new Error("Required parameter \"params['payload']\" missing.");
}
let data = {};
data["Sim"] = params["sim"];
data["Payload"] = params["payload"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
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 SmsCommandInstance(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["sim"] === null || params["sim"] === undefined) {
throw new Error("Required parameter \"params['sim']\" missing.");
}
if (params["payload"] === null || params["payload"] === undefined) {
throw new Error("Required parameter \"params['payload']\" missing.");
}
let data = {};
data["Sim"] = params["sim"];
data["Payload"] = params["payload"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
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 SmsCommandInstance(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["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 SmsCommandPage(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 SmsCommandPage(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["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 SmsCommandPage(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 SmsCommandPage(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 SmsCommandPage extends Page_1.default {
/**
* Initialize the SmsCommandPage
*
* @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 SmsCommandInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new SmsCommandInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SmsCommandPage = SmsCommandPage;

View File

@@ -0,0 +1,310 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period.
*/
export type UsageRecordGranularity = "hour" | "day" | "all";
/**
* Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter.
*/
export type UsageRecordGroup = "sim" | "fleet" | "network" | "isoCountry";
/**
* Options to pass to each
*/
export interface UsageRecordListInstanceEachOptions {
/** SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. */
sim?: string;
/** SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. */
fleet?: string;
/** SID of a Network resource. Only show UsageRecords representing usage on this network. */
network?: string;
/** Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. */
isoCountry?: string;
/** Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. */
group?: UsageRecordGroup;
/** Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. */
granularity?: UsageRecordGranularity;
/** Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. */
startTime?: Date;
/** Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. */
endTime?: Date;
/** 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: UsageRecordInstance, 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 UsageRecordListInstanceOptions {
/** SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. */
sim?: string;
/** SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. */
fleet?: string;
/** SID of a Network resource. Only show UsageRecords representing usage on this network. */
network?: string;
/** Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. */
isoCountry?: string;
/** Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. */
group?: UsageRecordGroup;
/** Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. */
granularity?: UsageRecordGranularity;
/** Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. */
startTime?: Date;
/** Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. */
endTime?: Date;
/** 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 UsageRecordListInstancePageOptions {
/** SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. */
sim?: string;
/** SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. */
fleet?: string;
/** SID of a Network resource. Only show UsageRecords representing usage on this network. */
network?: string;
/** Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. */
isoCountry?: string;
/** Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. */
group?: UsageRecordGroup;
/** Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. */
granularity?: UsageRecordGranularity;
/** Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. */
startTime?: Date;
/** Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. */
endTime?: Date;
/** 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 UsageRecordSolution {
}
export interface UsageRecordListInstance {
_version: V1;
_solution: UsageRecordSolution;
_uri: string;
/**
* Streams UsageRecordInstance 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 { UsageRecordListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void;
each(params: UsageRecordListInstanceEachOptions, callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void;
/**
* Streams UsageRecordInstance 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 { UsageRecordListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: UsageRecordListInstanceEachOptions, callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of UsageRecordInstance 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: UsageRecordPage) => any): Promise<UsageRecordPage>;
/**
* Retrieve a single target page of UsageRecordInstance 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<UsageRecordPage>) => any): Promise<ApiResponse<UsageRecordPage>>;
/**
* Lists UsageRecordInstance 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 { UsageRecordListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: UsageRecordInstance[]) => any): Promise<UsageRecordInstance[]>;
list(params: UsageRecordListInstanceOptions, callback?: (error: Error | null, items: UsageRecordInstance[]) => any): Promise<UsageRecordInstance[]>;
/**
* Lists UsageRecordInstance 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 { UsageRecordListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<UsageRecordInstance[]>) => any): Promise<ApiResponse<UsageRecordInstance[]>>;
listWithHttpInfo(params: UsageRecordListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<UsageRecordInstance[]>) => any): Promise<ApiResponse<UsageRecordInstance[]>>;
/**
* Retrieve a single page of UsageRecordInstance 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 { UsageRecordListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>;
page(params: UsageRecordListInstancePageOptions, callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>;
/**
* Retrieve a single page of UsageRecordInstance 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 { UsageRecordListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<UsageRecordPage>) => any): Promise<ApiResponse<UsageRecordPage>>;
pageWithHttpInfo(params: UsageRecordListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<UsageRecordPage>) => any): Promise<ApiResponse<UsageRecordPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function UsageRecordListInstance(version: V1): UsageRecordListInstance;
interface UsageRecordPayload extends TwilioResponsePayload {
usage_records: UsageRecordResource[];
}
interface UsageRecordResource {
account_sid: string;
sim_sid: string;
network_sid: string;
fleet_sid: string;
iso_country: string;
period: any;
data_upload: number;
data_download: number;
data_total: number;
data_total_billed: number;
billed_unit: string;
}
export declare class UsageRecordInstance {
protected _version: V1;
constructor(_version: V1, payload: UsageRecordResource);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that incurred the usage.
*/
accountSid: string;
/**
* SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the `Sim` query parameter is provided or when UsageRecords are grouped by `sim`. Otherwise, the value will be `null`.
*/
simSid: string;
/**
* SID of the Network resource the usage occurred on. Value will only be present when either a value for the `Network` query parameter is provided or when UsageRecords are grouped by `network`. Otherwise, the value will be `null`.
*/
networkSid: string;
/**
* SID of the Fleet resource the usage occurred on. Value will only be present when either a value for the `Fleet` query parameter is provided or when UsageRecords are grouped by `fleet`. Otherwise, the value will be `null`.
*/
fleetSid: string;
/**
* Alpha-2 ISO Country Code that the usage occurred in. Value will only be present when either a value for the `IsoCountry` query parameter is provided or when UsageRecords are grouped by `isoCountry`. Otherwise, the value will be `null`.
*/
isoCountry: string;
/**
* The time period for which the usage is reported. The period is represented as a pair of `start_time` and `end_time` timestamps specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
period: any;
/**
* Total data uploaded in bytes, aggregated by the query parameters.
*/
dataUpload: number;
/**
* Total data downloaded in bytes, aggregated by the query parameters.
*/
dataDownload: number;
/**
* Total of data_upload and data_download.
*/
dataTotal: number;
/**
* Total amount in the `billed_unit` that was charged for the data uploaded or downloaded. Will return 0 for usage prior to February 1, 2022. Value may be 0 despite `data_total` being greater than 0 if the data usage is still being processed by Twilio\'s billing system. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details.
*/
dataTotalBilled: number;
/**
* The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`). This can be null when data_toal_billed is 0 and we do not yet have billing information for the corresponding data usage. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details.
*/
billedUnit: string;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
simSid: string;
networkSid: string;
fleetSid: string;
isoCountry: string;
period: any;
dataUpload: number;
dataDownload: number;
dataTotal: number;
dataTotalBilled: number;
billedUnit: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class UsageRecordPage extends Page<V1, UsageRecordPayload, UsageRecordResource, UsageRecordInstance> {
/**
* Initialize the UsageRecordPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: UsageRecordSolution);
/**
* Build an instance of UsageRecordInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: UsageRecordResource): UsageRecordInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

219
node_modules/twilio/lib/rest/supersim/v1/usageRecord.js generated vendored Normal file
View File

@@ -0,0 +1,219 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Supersim
* 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.UsageRecordPage = exports.UsageRecordInstance = void 0;
exports.UsageRecordListInstance = UsageRecordListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function UsageRecordListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/UsageRecords`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["sim"] !== undefined)
data["Sim"] = params["sim"];
if (params["fleet"] !== undefined)
data["Fleet"] = params["fleet"];
if (params["network"] !== undefined)
data["Network"] = params["network"];
if (params["isoCountry"] !== undefined)
data["IsoCountry"] = params["isoCountry"];
if (params["group"] !== undefined)
data["Group"] = params["group"];
if (params["granularity"] !== undefined)
data["Granularity"] = params["granularity"];
if (params["startTime"] !== undefined)
data["StartTime"] = serialize.iso8601DateTime(params["startTime"]);
if (params["endTime"] !== undefined)
data["EndTime"] = serialize.iso8601DateTime(params["endTime"]);
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 UsageRecordPage(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 UsageRecordPage(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["sim"] !== undefined)
data["Sim"] = params["sim"];
if (params["fleet"] !== undefined)
data["Fleet"] = params["fleet"];
if (params["network"] !== undefined)
data["Network"] = params["network"];
if (params["isoCountry"] !== undefined)
data["IsoCountry"] = params["isoCountry"];
if (params["group"] !== undefined)
data["Group"] = params["group"];
if (params["granularity"] !== undefined)
data["Granularity"] = params["granularity"];
if (params["startTime"] !== undefined)
data["StartTime"] = serialize.iso8601DateTime(params["startTime"]);
if (params["endTime"] !== undefined)
data["EndTime"] = serialize.iso8601DateTime(params["endTime"]);
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 UsageRecordPage(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 UsageRecordPage(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 UsageRecordInstance {
constructor(_version, payload) {
this._version = _version;
this.accountSid = payload.account_sid;
this.simSid = payload.sim_sid;
this.networkSid = payload.network_sid;
this.fleetSid = payload.fleet_sid;
this.isoCountry = payload.iso_country;
this.period = payload.period;
this.dataUpload = payload.data_upload;
this.dataDownload = payload.data_download;
this.dataTotal = payload.data_total;
this.dataTotalBilled = payload.data_total_billed;
this.billedUnit = payload.billed_unit;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
simSid: this.simSid,
networkSid: this.networkSid,
fleetSid: this.fleetSid,
isoCountry: this.isoCountry,
period: this.period,
dataUpload: this.dataUpload,
dataDownload: this.dataDownload,
dataTotal: this.dataTotal,
dataTotalBilled: this.dataTotalBilled,
billedUnit: this.billedUnit,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.UsageRecordInstance = UsageRecordInstance;
class UsageRecordPage extends Page_1.default {
/**
* Initialize the UsageRecordPage
*
* @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 UsageRecordInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new UsageRecordInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.UsageRecordPage = UsageRecordPage;