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

30
node_modules/twilio/lib/rest/wireless/V1.d.ts generated vendored Normal file
View File

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

54
node_modules/twilio/lib/rest/wireless/V1.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Wireless
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Version_1 = __importDefault(require("../../base/Version"));
const command_1 = require("./v1/command");
const ratePlan_1 = require("./v1/ratePlan");
const sim_1 = require("./v1/sim");
const usageRecord_1 = require("./v1/usageRecord");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Wireless
*
* @param domain - The Twilio (Twilio.Wireless) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for commands resource */
get commands() {
this._commands = this._commands || (0, command_1.CommandListInstance)(this);
return this._commands;
}
/** Getter for ratePlans resource */
get ratePlans() {
this._ratePlans = this._ratePlans || (0, ratePlan_1.RatePlanListInstance)(this);
return this._ratePlans;
}
/** Getter for sims resource */
get sims() {
this._sims = this._sims || (0, sim_1.SimListInstance)(this);
return this._sims;
}
/** Getter for usageRecords resource */
get usageRecords() {
this._usageRecords = this._usageRecords || (0, usageRecord_1.UsageRecordListInstance)(this);
return this._usageRecords;
}
}
exports.default = V1;

421
node_modules/twilio/lib/rest/wireless/v1/command.d.ts generated vendored Normal file
View File

@@ -0,0 +1,421 @@
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 mode used to send the SMS message. Can be: `text` or `binary`. The default SMS mode is `text`.
*/
export type CommandCommandMode = "text" | "binary";
/**
* The direction of the 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 CommandDirection = "from_sim" | "to_sim";
/**
* The status of the Command. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. See [Status Values](https://www.twilio.com/docs/iot/wireless/api/command-resource#status-values) for a description of each state.
*/
export type CommandStatus = "queued" | "sent" | "delivered" | "received" | "failed";
/**
* The type of transport used. Can be: `sms` or `ip`.
*/
export type CommandTransport = "sms" | "ip";
/**
* Options to pass to create a CommandInstance
*/
export interface CommandListInstanceCreateOptions {
/** The message body of the Command. Can be plain text in text mode or a Base64 encoded byte string in binary mode. */
command: string;
/** The `sid` or `unique_name` of the [SIM](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to send the Command to. */
sim?: string;
/** The HTTP method we use to call `callback_url`. Can be: `POST` or `GET`, and the default is `POST`. */
callbackMethod?: string;
/** The URL we call using the `callback_url` when the Command has finished sending, whether the command was delivered or it failed. */
callbackUrl?: string;
/** */
commandMode?: CommandCommandMode;
/** Whether to include the SID of the command in the message body. Can be: `none`, `start`, or `end`, and the default behavior is `none`. When sending a Command to a SIM in text mode, we can automatically include the SID of the Command in the message body, which could be used to ensure that the device does not process the same Command more than once. A value of `start` will prepend the message with the Command SID, and `end` will append it to the end, separating the Command SID from the message body with a space. The length of the Command SID is included in the 160 character limit so the SMS body must be 128 characters or less before the Command SID is included. */
includeSid?: string;
/** Whether to request delivery receipt from the recipient. For Commands that request delivery receipt, the Command state transitions to \\\'delivered\\\' once the server has received a delivery receipt from the device. The default value is `true`. */
deliveryReceiptRequested?: boolean;
}
/**
* Options to pass to each
*/
export interface CommandListInstanceEachOptions {
/** The `sid` or `unique_name` of the [Sim resources](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to read. */
sim?: string;
/** The status of the resources to read. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. */
status?: CommandStatus;
/** Only return Commands with this direction value. */
direction?: CommandDirection;
/** Only return Commands with this transport value. Can be: `sms` or `ip`. */
transport?: CommandTransport;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: CommandInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface CommandListInstanceOptions {
/** The `sid` or `unique_name` of the [Sim resources](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to read. */
sim?: string;
/** The status of the resources to read. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. */
status?: CommandStatus;
/** Only return Commands with this direction value. */
direction?: CommandDirection;
/** Only return Commands with this transport value. Can be: `sms` or `ip`. */
transport?: CommandTransport;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface CommandListInstancePageOptions {
/** The `sid` or `unique_name` of the [Sim resources](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to read. */
sim?: string;
/** The status of the resources to read. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. */
status?: CommandStatus;
/** Only return Commands with this direction value. */
direction?: CommandDirection;
/** Only return Commands with this transport value. Can be: `sms` or `ip`. */
transport?: CommandTransport;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface CommandContext {
/**
* Remove a CommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CommandInstance 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 CommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance
*/
fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>;
/**
* Fetch a CommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CommandInstance>) => any): Promise<ApiResponse<CommandInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CommandContextSolution {
sid: string;
}
export declare class CommandContextImpl implements CommandContext {
protected _version: V1;
protected _solution: CommandContextSolution;
protected _uri: string;
constructor(_version: V1, 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?: CommandInstance) => any): Promise<CommandInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CommandInstance>) => any): Promise<ApiResponse<CommandInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CommandContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CommandPayload extends TwilioResponsePayload {
commands: CommandResource[];
}
interface CommandResource {
sid: string;
account_sid: string;
sim_sid: string;
command: string;
command_mode: CommandCommandMode;
transport: CommandTransport;
delivery_receipt_requested: boolean;
status: CommandStatus;
direction: CommandDirection;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class CommandInstance {
protected _version: V1;
protected _solution: CommandContextSolution;
protected _context?: CommandContext;
constructor(_version: V1, payload: CommandResource, sid?: string);
/**
* The unique string that we created to identify the Command resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Command resource.
*/
accountSid: string;
/**
* The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that the Command was sent to or from.
*/
simSid: string;
/**
* The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64.
*/
command: string;
commandMode: CommandCommandMode;
transport: CommandTransport;
/**
* Whether to request a delivery receipt.
*/
deliveryReceiptRequested: boolean;
status: CommandStatus;
direction: CommandDirection;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Remove a CommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CommandInstance 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 CommandInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance
*/
fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>;
/**
* Fetch a CommandInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CommandInstance>) => any): Promise<ApiResponse<CommandInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
simSid: string;
command: string;
commandMode: CommandCommandMode;
transport: CommandTransport;
deliveryReceiptRequested: boolean;
status: CommandStatus;
direction: CommandDirection;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CommandSolution {
}
export interface CommandListInstance {
_version: V1;
_solution: CommandSolution;
_uri: string;
(sid: string): CommandContext;
get(sid: string): CommandContext;
/**
* Create a CommandInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance
*/
create(params: CommandListInstanceCreateOptions, callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>;
/**
* Create a CommandInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CommandInstance with HTTP metadata
*/
createWithHttpInfo(params: CommandListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<CommandInstance>) => any): Promise<ApiResponse<CommandInstance>>;
/**
* Streams CommandInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void;
each(params: CommandListInstanceEachOptions, callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CommandInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CommandListInstanceEachOptions, callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CommandInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>;
/**
* Retrieve a single target page of CommandInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<CommandPage>) => any): Promise<ApiResponse<CommandPage>>;
/**
* Lists CommandInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CommandInstance[]) => any): Promise<CommandInstance[]>;
list(params: CommandListInstanceOptions, callback?: (error: Error | null, items: CommandInstance[]) => any): Promise<CommandInstance[]>;
/**
* Lists CommandInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CommandInstance[]>) => any): Promise<ApiResponse<CommandInstance[]>>;
listWithHttpInfo(params: CommandListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CommandInstance[]>) => any): Promise<ApiResponse<CommandInstance[]>>;
/**
* Retrieve a single page of CommandInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>;
page(params: CommandListInstancePageOptions, callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>;
/**
* Retrieve a single page of CommandInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { CommandListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CommandPage>) => any): Promise<ApiResponse<CommandPage>>;
pageWithHttpInfo(params: CommandListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CommandPage>) => any): Promise<ApiResponse<CommandPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CommandListInstance(version: V1): CommandListInstance;
export declare class CommandPage extends Page<V1, CommandPayload, CommandResource, CommandInstance> {
/**
* Initialize the CommandPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: CommandSolution);
/**
* Build an instance of CommandInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CommandResource): CommandInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

409
node_modules/twilio/lib/rest/wireless/v1/command.js generated vendored Normal file
View File

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

526
node_modules/twilio/lib/rest/wireless/v1/ratePlan.d.ts generated vendored Normal file
View File

@@ -0,0 +1,526 @@
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 way the home network (T-Mobile USA) will behave after a SIM\'s usage exceeds its `data_limit`. Can be either `block` or `throttle`. Default is `block`.
*/
export type RatePlanDataLimitStrategy = "block" | "throttle";
/**
* Options to pass to update a RatePlanInstance
*/
export interface RatePlanContextUpdateOptions {
/** 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;
/** A descriptive string that you create to describe the resource. It does not have to be unique. */
friendlyName?: string;
}
/**
* Options to pass to create a RatePlanInstance
*/
export interface RatePlanListInstanceCreateOptions {
/** 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;
/** A descriptive string that you create to describe the resource. It does not have to be unique. */
friendlyName?: string;
/** Whether SIMs can use GPRS/3G/4G/LTE data connectivity. */
dataEnabled?: boolean;
/** The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB and the default value is `1000`. */
dataLimit?: number;
/** The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#payg-vs-quota-data-plans). */
dataMetering?: string;
/** Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/iot/wireless/api/command-resource). */
messagingEnabled?: boolean;
/** Deprecated. */
voiceEnabled?: boolean;
/** Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming). */
nationalRoamingEnabled?: boolean;
/** The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. */
internationalRoaming?: Array<string>;
/** The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. */
nationalRoamingDataLimit?: number;
/** The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. */
internationalRoamingDataLimit?: number;
/** */
dataLimitStrategy?: RatePlanDataLimitStrategy;
}
/**
* Options to pass to each
*/
export interface RatePlanListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface RatePlanListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface RatePlanListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface RatePlanContext {
/**
* Remove a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Fetch a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Update a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
update(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Update a RatePlanInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
update(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Update a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Update a RatePlanInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
updateWithHttpInfo(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface RatePlanContextSolution {
sid: string;
}
export declare class RatePlanContextImpl implements RatePlanContext {
protected _version: V1;
protected _solution: RatePlanContextSolution;
protected _uri: string;
constructor(_version: V1, sid: string);
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
update(params?: RatePlanContextUpdateOptions | ((error: Error | null, item?: RatePlanInstance) => any), callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
updateWithHttpInfo(params?: RatePlanContextUpdateOptions | ((error: Error | null, item?: ApiResponse<RatePlanInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): RatePlanContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface RatePlanPayload extends TwilioResponsePayload {
rate_plans: RatePlanResource[];
}
interface RatePlanResource {
sid: string;
unique_name: string;
account_sid: string;
friendly_name: string;
data_enabled: boolean;
data_metering: string;
data_limit: number;
messaging_enabled: boolean;
voice_enabled: boolean;
national_roaming_enabled: boolean;
national_roaming_data_limit: number;
international_roaming: Array<string>;
international_roaming_data_limit: number;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class RatePlanInstance {
protected _version: V1;
protected _solution: RatePlanContextSolution;
protected _context?: RatePlanContext;
constructor(_version: V1, payload: RatePlanResource, sid?: string);
/**
* The unique string that we created to identify the RatePlan 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 created the RatePlan resource.
*/
accountSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* Whether SIMs can use GPRS/3G/4G/LTE data connectivity.
*/
dataEnabled: boolean;
/**
* The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#payg-vs-quota-data-plans).
*/
dataMetering: string;
/**
* The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB.
*/
dataLimit: number;
/**
* Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/iot/wireless/api/command-resource).
*/
messagingEnabled: boolean;
/**
* Deprecated. Whether SIMs can make and receive voice calls.
*/
voiceEnabled: boolean;
/**
* Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming).
*/
nationalRoamingEnabled: boolean;
/**
* The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB.
*/
nationalRoamingDataLimit: number;
/**
* The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`.
*/
internationalRoaming: Array<string>;
/**
* The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB.
*/
internationalRoamingDataLimit: number;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Remove a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Fetch a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Update a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
update(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Update a RatePlanInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
update(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Update a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Update a RatePlanInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
updateWithHttpInfo(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
uniqueName: string;
accountSid: string;
friendlyName: string;
dataEnabled: boolean;
dataMetering: string;
dataLimit: number;
messagingEnabled: boolean;
voiceEnabled: boolean;
nationalRoamingEnabled: boolean;
nationalRoamingDataLimit: number;
internationalRoaming: string[];
internationalRoamingDataLimit: number;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface RatePlanSolution {
}
export interface RatePlanListInstance {
_version: V1;
_solution: RatePlanSolution;
_uri: string;
(sid: string): RatePlanContext;
get(sid: string): RatePlanContext;
/**
* Create a RatePlanInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
create(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Create a RatePlanInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance
*/
create(params: RatePlanListInstanceCreateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>;
/**
* Create a RatePlanInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Create a RatePlanInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed RatePlanInstance with HTTP metadata
*/
createWithHttpInfo(params: RatePlanListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<RatePlanInstance>) => any): Promise<ApiResponse<RatePlanInstance>>;
/**
* Streams RatePlanInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void;
each(params: RatePlanListInstanceEachOptions, callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void;
/**
* Streams RatePlanInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: RatePlanListInstanceEachOptions, callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of RatePlanInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>;
/**
* Retrieve a single target page of RatePlanInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<RatePlanPage>) => any): Promise<ApiResponse<RatePlanPage>>;
/**
* Lists RatePlanInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: RatePlanInstance[]) => any): Promise<RatePlanInstance[]>;
list(params: RatePlanListInstanceOptions, callback?: (error: Error | null, items: RatePlanInstance[]) => any): Promise<RatePlanInstance[]>;
/**
* Lists RatePlanInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<RatePlanInstance[]>) => any): Promise<ApiResponse<RatePlanInstance[]>>;
listWithHttpInfo(params: RatePlanListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<RatePlanInstance[]>) => any): Promise<ApiResponse<RatePlanInstance[]>>;
/**
* Retrieve a single page of RatePlanInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>;
page(params: RatePlanListInstancePageOptions, callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>;
/**
* Retrieve a single page of RatePlanInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { RatePlanListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<RatePlanPage>) => any): Promise<ApiResponse<RatePlanPage>>;
pageWithHttpInfo(params: RatePlanListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<RatePlanPage>) => any): Promise<ApiResponse<RatePlanPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function RatePlanListInstance(version: V1): RatePlanListInstance;
export declare class RatePlanPage extends Page<V1, RatePlanPayload, RatePlanResource, RatePlanInstance> {
/**
* Initialize the RatePlanPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: RatePlanSolution);
/**
* Build an instance of RatePlanInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: RatePlanResource): RatePlanInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

493
node_modules/twilio/lib/rest/wireless/v1/ratePlan.js generated vendored Normal file
View File

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

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

@@ -0,0 +1,587 @@
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 { DataSessionListInstance } from "./sim/dataSession";
import { UsageRecordListInstance } from "./sim/usageRecord";
/**
* The connectivity reset status of the SIM. Can be: null or `resetting`. When a connectivity reset is initiated on a SIM, this property is `resetting`. After the reset completes, it is null.
*/
export type SimResetStatus = "resetting";
/**
* The status of the Sim resource. Can be: `new`, `ready`, `active`, `deactivated`, `canceled`, `deleted`, `scheduled`, or `updating`. See [Status Values](https://www.twilio.com/docs/iot/wireless/api/sim-resource#status-values) for the description of each status.
*/
export type SimStatus = "new" | "ready" | "active" | "suspended" | "deactivated" | "canceled" | "scheduled" | "updating";
/**
* 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 `sid` in the URL path to address the resource. */
uniqueName?: string;
/** The HTTP method we should use to call `callback_url`. Can be: `POST` or `GET`. The default is `POST`. */
callbackMethod?: string;
/** The URL we should call using the `callback_url` when the SIM has finished updating. When the SIM transitions from `new` to `ready` or from any status to `deactivated`, we call this URL when the status changes to an intermediate status (`ready` or `deactivated`) and again when the status changes to its final status (`active` or `canceled`). */
callbackUrl?: string;
/** A descriptive string that you create to describe the Sim resource. It does not need to be unique. */
friendlyName?: string;
/** The SID or unique name of the [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource should be assigned. */
ratePlan?: string;
/** */
status?: SimStatus;
/** The HTTP method we should use to call `commands_callback_url`. Can be: `POST` or `GET`. The default is `POST`. */
commandsCallbackMethod?: string;
/** The URL we should call using the `commands_callback_method` when the SIM sends a [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body is ignored. */
commandsCallbackUrl?: string;
/** The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. */
smsFallbackMethod?: string;
/** The URL we should call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `sms_url`. */
smsFallbackUrl?: string;
/** The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. Default is `POST`. */
smsMethod?: string;
/** The URL we should call using the `sms_method` when the SIM-connected device sends an SMS message that is not a [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). */
smsUrl?: string;
/** Deprecated. */
voiceFallbackMethod?: string;
/** Deprecated. */
voiceFallbackUrl?: string;
/** Deprecated. */
voiceMethod?: string;
/** Deprecated. */
voiceUrl?: string;
/** */
resetStatus?: SimResetStatus;
/** The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a [Subaccount](https://www.twilio.com/docs/iam/api/subaccounts) of the requesting Account. Only valid when the Sim resource\\\'s status is `new`. For more information, see the [Move SIMs between Subaccounts documentation](https://www.twilio.com/docs/iot/wireless/api/sim-resource#move-sims-between-subaccounts). */
accountSid?: string;
}
/**
* Options to pass to each
*/
export interface SimListInstanceEachOptions {
/** Only return Sim resources with this status. */
status?: SimStatus;
/** Only return Sim resources with this ICCID. This will return a list with a maximum size of 1. */
iccid?: string;
/** The SID or unique name of a [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource). Only return Sim resources assigned to this RatePlan resource. */
ratePlan?: string;
/** Deprecated. */
eId?: string;
/** Only return Sim resources with this registration code. This will return a list with a maximum size of 1. */
simRegistrationCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: SimInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface SimListInstanceOptions {
/** Only return Sim resources with this status. */
status?: SimStatus;
/** Only return Sim resources with this ICCID. This will return a list with a maximum size of 1. */
iccid?: string;
/** The SID or unique name of a [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource). Only return Sim resources assigned to this RatePlan resource. */
ratePlan?: string;
/** Deprecated. */
eId?: string;
/** Only return Sim resources with this registration code. This will return a list with a maximum size of 1. */
simRegistrationCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface SimListInstancePageOptions {
/** Only return Sim resources with this status. */
status?: SimStatus;
/** Only return Sim resources with this ICCID. This will return a list with a maximum size of 1. */
iccid?: string;
/** The SID or unique name of a [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource). Only return Sim resources assigned to this RatePlan resource. */
ratePlan?: string;
/** Deprecated. */
eId?: string;
/** Only return Sim resources with this registration code. This will return a list with a maximum size of 1. */
simRegistrationCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface SimContext {
dataSessions: DataSessionListInstance;
usageRecords: UsageRecordListInstance;
/**
* Remove a SimInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a SimInstance 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 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 _dataSessions?: DataSessionListInstance;
protected _usageRecords?: UsageRecordListInstance;
constructor(_version: V1, sid: string);
get dataSessions(): DataSessionListInstance;
get usageRecords(): UsageRecordListInstance;
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?: SimInstance) => any): Promise<SimInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
update(params?: SimContextUpdateOptions | ((error: Error | null, item?: SimInstance) => any), callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>;
updateWithHttpInfo(params?: SimContextUpdateOptions | ((error: Error | null, item?: ApiResponse<SimInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<SimInstance>) => any): Promise<ApiResponse<SimInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): SimContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface SimPayload extends TwilioResponsePayload {
sims: SimResource[];
}
interface SimResource {
sid: string;
unique_name: string;
account_sid: string;
rate_plan_sid: string;
friendly_name: string;
iccid: string;
e_id: string;
status: SimStatus;
reset_status: SimResetStatus;
commands_callback_url: string;
commands_callback_method: string;
sms_fallback_method: string;
sms_fallback_url: string;
sms_method: string;
sms_url: string;
voice_fallback_method: string;
voice_fallback_url: string;
voice_method: string;
voice_url: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
ip_address: 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 we created to identify 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) to which the Sim resource belongs.
*/
accountSid: string;
/**
* The SID of the [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource is assigned.
*/
ratePlanSid: string;
/**
* The string that you assigned to describe the Sim resource.
*/
friendlyName: string;
/**
* The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM.
*/
iccid: string;
/**
* Deprecated.
*/
eId: string;
status: SimStatus;
resetStatus: SimResetStatus;
/**
* The URL we call using the `commands_callback_method` when the SIM originates a machine-to-machine [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.
*/
commandsCallbackUrl: string;
/**
* The HTTP method we use to call `commands_callback_url`. Can be: `POST` or `GET`. Default is `POST`.
*/
commandsCallbackMethod: string;
/**
* Deprecated.
*/
smsFallbackMethod: string;
/**
* Deprecated.
*/
smsFallbackUrl: string;
/**
* Deprecated.
*/
smsMethod: string;
/**
* Deprecated.
*/
smsUrl: string;
/**
* Deprecated. The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. Default is `POST`.
*/
voiceFallbackMethod: string;
/**
* Deprecated. The URL we call using the `voice_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `voice_url`.
*/
voiceFallbackUrl: string;
/**
* Deprecated. The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. Default is `POST`.
*/
voiceMethod: string;
/**
* Deprecated. The URL we call using the `voice_method` when the SIM-connected device makes a voice call.
*/
voiceUrl: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Sim resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of related subresources.
*/
links: Record<string, string>;
/**
* Deprecated.
*/
ipAddress: string;
private get _proxy();
/**
* Remove a SimInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a SimInstance 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 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 dataSessions.
*/
dataSessions(): DataSessionListInstance;
/**
* Access the usageRecords.
*/
usageRecords(): UsageRecordListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
uniqueName: string;
accountSid: string;
ratePlanSid: string;
friendlyName: string;
iccid: string;
eId: string;
status: SimStatus;
resetStatus: "resetting";
commandsCallbackUrl: string;
commandsCallbackMethod: string;
smsFallbackMethod: string;
smsFallbackUrl: string;
smsMethod: string;
smsUrl: string;
voiceFallbackMethod: string;
voiceFallbackUrl: string;
voiceMethod: string;
voiceUrl: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
ipAddress: 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;
/**
* 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 {};

518
node_modules/twilio/lib/rest/wireless/v1/sim.js generated vendored Normal file
View File

@@ -0,0 +1,518 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Wireless
* 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 dataSession_1 = require("./sim/dataSession");
const usageRecord_1 = require("./sim/usageRecord");
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 dataSessions() {
this._dataSessions =
this._dataSessions ||
(0, dataSession_1.DataSessionListInstance)(this._version, this._solution.sid);
return this._dataSessions;
}
get usageRecords() {
this._usageRecords =
this._usageRecords ||
(0, usageRecord_1.UsageRecordListInstance)(this._version, this._solution.sid);
return this._usageRecords;
}
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 SimInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new SimInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["ratePlan"] !== undefined)
data["RatePlan"] = params["ratePlan"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["commandsCallbackMethod"] !== undefined)
data["CommandsCallbackMethod"] = params["commandsCallbackMethod"];
if (params["commandsCallbackUrl"] !== undefined)
data["CommandsCallbackUrl"] = params["commandsCallbackUrl"];
if (params["smsFallbackMethod"] !== undefined)
data["SmsFallbackMethod"] = params["smsFallbackMethod"];
if (params["smsFallbackUrl"] !== undefined)
data["SmsFallbackUrl"] = params["smsFallbackUrl"];
if (params["smsMethod"] !== undefined)
data["SmsMethod"] = params["smsMethod"];
if (params["smsUrl"] !== undefined)
data["SmsUrl"] = params["smsUrl"];
if (params["voiceFallbackMethod"] !== undefined)
data["VoiceFallbackMethod"] = params["voiceFallbackMethod"];
if (params["voiceFallbackUrl"] !== undefined)
data["VoiceFallbackUrl"] = params["voiceFallbackUrl"];
if (params["voiceMethod"] !== undefined)
data["VoiceMethod"] = params["voiceMethod"];
if (params["voiceUrl"] !== undefined)
data["VoiceUrl"] = params["voiceUrl"];
if (params["resetStatus"] !== undefined)
data["ResetStatus"] = params["resetStatus"];
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["callbackMethod"] !== undefined)
data["CallbackMethod"] = params["callbackMethod"];
if (params["callbackUrl"] !== undefined)
data["CallbackUrl"] = params["callbackUrl"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["ratePlan"] !== undefined)
data["RatePlan"] = params["ratePlan"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["commandsCallbackMethod"] !== undefined)
data["CommandsCallbackMethod"] = params["commandsCallbackMethod"];
if (params["commandsCallbackUrl"] !== undefined)
data["CommandsCallbackUrl"] = params["commandsCallbackUrl"];
if (params["smsFallbackMethod"] !== undefined)
data["SmsFallbackMethod"] = params["smsFallbackMethod"];
if (params["smsFallbackUrl"] !== undefined)
data["SmsFallbackUrl"] = params["smsFallbackUrl"];
if (params["smsMethod"] !== undefined)
data["SmsMethod"] = params["smsMethod"];
if (params["smsUrl"] !== undefined)
data["SmsUrl"] = params["smsUrl"];
if (params["voiceFallbackMethod"] !== undefined)
data["VoiceFallbackMethod"] = params["voiceFallbackMethod"];
if (params["voiceFallbackUrl"] !== undefined)
data["VoiceFallbackUrl"] = params["voiceFallbackUrl"];
if (params["voiceMethod"] !== undefined)
data["VoiceMethod"] = params["voiceMethod"];
if (params["voiceUrl"] !== undefined)
data["VoiceUrl"] = params["voiceUrl"];
if (params["resetStatus"] !== undefined)
data["ResetStatus"] = params["resetStatus"];
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.ratePlanSid = payload.rate_plan_sid;
this.friendlyName = payload.friendly_name;
this.iccid = payload.iccid;
this.eId = payload.e_id;
this.status = payload.status;
this.resetStatus = payload.reset_status;
this.commandsCallbackUrl = payload.commands_callback_url;
this.commandsCallbackMethod = payload.commands_callback_method;
this.smsFallbackMethod = payload.sms_fallback_method;
this.smsFallbackUrl = payload.sms_fallback_url;
this.smsMethod = payload.sms_method;
this.smsUrl = payload.sms_url;
this.voiceFallbackMethod = payload.voice_fallback_method;
this.voiceFallbackUrl = payload.voice_fallback_url;
this.voiceMethod = payload.voice_method;
this.voiceUrl = payload.voice_url;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this.ipAddress = payload.ip_address;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context || new SimContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a SimInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a SimInstance 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 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 dataSessions.
*/
dataSessions() {
return this._proxy.dataSessions;
}
/**
* Access the usageRecords.
*/
usageRecords() {
return this._proxy.usageRecords;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
uniqueName: this.uniqueName,
accountSid: this.accountSid,
ratePlanSid: this.ratePlanSid,
friendlyName: this.friendlyName,
iccid: this.iccid,
eId: this.eId,
status: this.status,
resetStatus: this.resetStatus,
commandsCallbackUrl: this.commandsCallbackUrl,
commandsCallbackMethod: this.commandsCallbackMethod,
smsFallbackMethod: this.smsFallbackMethod,
smsFallbackUrl: this.smsFallbackUrl,
smsMethod: this.smsMethod,
smsUrl: this.smsUrl,
voiceFallbackMethod: this.voiceFallbackMethod,
voiceFallbackUrl: this.voiceFallbackUrl,
voiceMethod: this.voiceMethod,
voiceUrl: this.voiceUrl,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
ipAddress: this.ipAddress,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SimInstance = SimInstance;
function SimListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new SimContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Sims`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["iccid"] !== undefined)
data["Iccid"] = params["iccid"];
if (params["ratePlan"] !== undefined)
data["RatePlan"] = params["ratePlan"];
if (params["eId"] !== undefined)
data["EId"] = params["eId"];
if (params["simRegistrationCode"] !== undefined)
data["SimRegistrationCode"] = params["simRegistrationCode"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new SimPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new SimPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["iccid"] !== undefined)
data["Iccid"] = params["iccid"];
if (params["ratePlan"] !== undefined)
data["RatePlan"] = params["ratePlan"];
if (params["eId"] !== undefined)
data["EId"] = params["eId"];
if (params["simRegistrationCode"] !== undefined)
data["SimRegistrationCode"] = params["simRegistrationCode"];
if (params["pageSize"] !== undefined)
data["PageSize"] = params["pageSize"];
if (params.pageNumber !== undefined)
data["Page"] = params.pageNumber;
if (params.pageToken !== undefined)
data["PageToken"] = params.pageToken;
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new SimPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new SimPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class SimPage extends Page_1.default {
/**
* Initialize the SimPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of SimInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new SimInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SimPage = SimPage;

View File

@@ -0,0 +1,285 @@
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 DataSessionListInstanceEachOptions {
/** 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: DataSessionInstance, 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 DataSessionListInstanceOptions {
/** 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 DataSessionListInstancePageOptions {
/** 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 DataSessionSolution {
simSid: string;
}
export interface DataSessionListInstance {
_version: V1;
_solution: DataSessionSolution;
_uri: string;
/**
* Streams DataSessionInstance 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 { DataSessionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: DataSessionInstance, done: (err?: Error) => void) => void): void;
each(params: DataSessionListInstanceEachOptions, callback?: (item: DataSessionInstance, done: (err?: Error) => void) => void): void;
/**
* Streams DataSessionInstance 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 { DataSessionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: DataSessionInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: DataSessionListInstanceEachOptions, callback?: (item: DataSessionInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of DataSessionInstance 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: DataSessionPage) => any): Promise<DataSessionPage>;
/**
* Retrieve a single target page of DataSessionInstance 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<DataSessionPage>) => any): Promise<ApiResponse<DataSessionPage>>;
/**
* Lists DataSessionInstance 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 { DataSessionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: DataSessionInstance[]) => any): Promise<DataSessionInstance[]>;
list(params: DataSessionListInstanceOptions, callback?: (error: Error | null, items: DataSessionInstance[]) => any): Promise<DataSessionInstance[]>;
/**
* Lists DataSessionInstance 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 { DataSessionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<DataSessionInstance[]>) => any): Promise<ApiResponse<DataSessionInstance[]>>;
listWithHttpInfo(params: DataSessionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<DataSessionInstance[]>) => any): Promise<ApiResponse<DataSessionInstance[]>>;
/**
* Retrieve a single page of DataSessionInstance 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 { DataSessionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: DataSessionPage) => any): Promise<DataSessionPage>;
page(params: DataSessionListInstancePageOptions, callback?: (error: Error | null, items: DataSessionPage) => any): Promise<DataSessionPage>;
/**
* Retrieve a single page of DataSessionInstance 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 { DataSessionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<DataSessionPage>) => any): Promise<ApiResponse<DataSessionPage>>;
pageWithHttpInfo(params: DataSessionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<DataSessionPage>) => any): Promise<ApiResponse<DataSessionPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function DataSessionListInstance(version: V1, simSid: string): DataSessionListInstance;
interface DataSessionPayload extends TwilioResponsePayload {
data_sessions: DataSessionResource[];
}
interface DataSessionResource {
sid: string;
sim_sid: string;
account_sid: string;
radio_link: string;
operator_mcc: string;
operator_mnc: string;
operator_country: string;
operator_name: string;
cell_id: string;
cell_location_estimate: any;
packets_uploaded: number;
packets_downloaded: number;
last_updated: Date;
start: Date;
end: Date;
imei: string;
}
export declare class DataSessionInstance {
protected _version: V1;
constructor(_version: V1, payload: DataSessionResource, simSid: string);
/**
* The unique string that we created to identify the DataSession resource.
*/
sid: string;
/**
* The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that the Data Session is for.
*/
simSid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DataSession resource.
*/
accountSid: string;
/**
* The generation of wireless technology that the device was using.
*/
radioLink: string;
/**
* The \'mobile country code\' is the unique ID of the home country where the Data Session took place. See: [MCC/MNC lookup](http://mcc-mnc.com/).
*/
operatorMcc: string;
/**
* The \'mobile network code\' is the unique ID specific to the mobile operator network where the Data Session took place.
*/
operatorMnc: string;
/**
* The three letter country code representing where the device\'s Data Session took place. This is determined by looking up the `operator_mcc`.
*/
operatorCountry: string;
/**
* The friendly name of the mobile operator network that the [SIM](https://www.twilio.com/docs/iot/wireless/api/sim-resource)-connected device is attached to. This is determined by looking up the `operator_mnc`.
*/
operatorName: string;
/**
* The unique ID of the cellular tower that the device was attached to at the moment when the Data Session was last updated.
*/
cellId: string;
/**
* An object that describes the estimated location in latitude and longitude where the device\'s Data Session took place. The location is derived from the `cell_id` when the Data Session was last updated. See [Cell Location Estimate Object](https://www.twilio.com/docs/iot/wireless/api/datasession-resource#cell-location-estimate-object).
*/
cellLocationEstimate: any;
/**
* The number of packets uploaded by the device between the `start` time and when the Data Session was last updated.
*/
packetsUploaded: number;
/**
* The number of packets downloaded by the device between the `start` time and when the Data Session was last updated.
*/
packetsDownloaded: number;
/**
* The date that the resource was last updated, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
lastUpdated: Date;
/**
* The date that the Data Session started, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
start: Date;
/**
* The date that the record ended, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
end: Date;
/**
* The \'international mobile equipment identity\' is the unique ID of the device using the SIM to connect. An IMEI is a 15-digit string: 14 digits for the device identifier plus a check digit calculated using the Luhn formula.
*/
imei: string;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
simSid: string;
accountSid: string;
radioLink: string;
operatorMcc: string;
operatorMnc: string;
operatorCountry: string;
operatorName: string;
cellId: string;
cellLocationEstimate: any;
packetsUploaded: number;
packetsDownloaded: number;
lastUpdated: Date;
start: Date;
end: Date;
imei: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class DataSessionPage extends Page<V1, DataSessionPayload, DataSessionResource, DataSessionInstance> {
/**
* Initialize the DataSessionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: DataSessionSolution);
/**
* Build an instance of DataSessionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: DataSessionResource): DataSessionInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,201 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Wireless
* 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.DataSessionPage = exports.DataSessionInstance = void 0;
exports.DataSessionListInstance = DataSessionListInstance;
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 DataSessionListInstance(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}/DataSessions`;
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 DataSessionPage(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 DataSessionPage(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 DataSessionPage(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 DataSessionPage(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 DataSessionInstance {
constructor(_version, payload, simSid) {
this._version = _version;
this.sid = payload.sid;
this.simSid = payload.sim_sid;
this.accountSid = payload.account_sid;
this.radioLink = payload.radio_link;
this.operatorMcc = payload.operator_mcc;
this.operatorMnc = payload.operator_mnc;
this.operatorCountry = payload.operator_country;
this.operatorName = payload.operator_name;
this.cellId = payload.cell_id;
this.cellLocationEstimate = payload.cell_location_estimate;
this.packetsUploaded = deserialize.integer(payload.packets_uploaded);
this.packetsDownloaded = deserialize.integer(payload.packets_downloaded);
this.lastUpdated = deserialize.iso8601DateTime(payload.last_updated);
this.start = deserialize.iso8601DateTime(payload.start);
this.end = deserialize.iso8601DateTime(payload.end);
this.imei = payload.imei;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
simSid: this.simSid,
accountSid: this.accountSid,
radioLink: this.radioLink,
operatorMcc: this.operatorMcc,
operatorMnc: this.operatorMnc,
operatorCountry: this.operatorCountry,
operatorName: this.operatorName,
cellId: this.cellId,
cellLocationEstimate: this.cellLocationEstimate,
packetsUploaded: this.packetsUploaded,
packetsDownloaded: this.packetsDownloaded,
lastUpdated: this.lastUpdated,
start: this.start,
end: this.end,
imei: this.imei,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DataSessionInstance = DataSessionInstance;
class DataSessionPage extends Page_1.default {
/**
* Initialize the DataSessionPage
*
* @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 DataSessionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new DataSessionInstance(this._version, payload, this._solution.simSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.DataSessionPage = DataSessionPage;

View File

@@ -0,0 +1,241 @@
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";
/**
* How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period.
*/
export type UsageRecordGranularity = "hourly" | "daily" | "all";
/**
* Options to pass to each
*/
export interface UsageRecordListInstanceEachOptions {
/** Only include usage that occurred on or before this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is the current time. */
end?: Date;
/** Only include usage that has occurred on or after this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is one month before the `end` parameter value. */
start?: Date;
/** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */
granularity?: UsageRecordGranularity;
/** 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 {
/** Only include usage that occurred on or before this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is the current time. */
end?: Date;
/** Only include usage that has occurred on or after this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is one month before the `end` parameter value. */
start?: Date;
/** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */
granularity?: UsageRecordGranularity;
/** 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 {
/** Only include usage that occurred on or before this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is the current time. */
end?: Date;
/** Only include usage that has occurred on or after this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is one month before the `end` parameter value. */
start?: Date;
/** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */
granularity?: UsageRecordGranularity;
/** 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 {
simSid: string;
}
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, simSid: string): UsageRecordListInstance;
interface UsageRecordPayload extends TwilioResponsePayload {
usage_records: UsageRecordResource[];
}
interface UsageRecordResource {
sim_sid: string;
account_sid: string;
period: any;
commands: any;
data: any;
}
export declare class UsageRecordInstance {
protected _version: V1;
constructor(_version: V1, payload: UsageRecordResource, simSid: string);
/**
* The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that this Usage Record is for.
*/
simSid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resource.
*/
accountSid: string;
/**
* The time period for which the usage is reported. Contains `start` and `end` datetime values given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
period: any;
/**
* An object that describes the SIM\'s usage of Commands during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/iot/wireless/api/sim-usagerecord-resource#commands-usage-object).
*/
commands: any;
/**
* An object that describes the SIM\'s data usage during the specified period. See [Data Usage Object](https://www.twilio.com/docs/iot/wireless/api/sim-usagerecord-resource#data-usage-object).
*/
data: any;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
simSid: string;
accountSid: string;
period: any;
commands: any;
data: any;
};
[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 {};

View File

@@ -0,0 +1,191 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Wireless
* 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");
const utility_1 = require("../../../../base/utility");
function UsageRecordListInstance(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}/UsageRecords`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["end"] !== undefined)
data["End"] = serialize.iso8601DateTime(params["end"]);
if (params["start"] !== undefined)
data["Start"] = serialize.iso8601DateTime(params["start"]);
if (params["granularity"] !== undefined)
data["Granularity"] = params["granularity"];
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["end"] !== undefined)
data["End"] = serialize.iso8601DateTime(params["end"]);
if (params["start"] !== undefined)
data["Start"] = serialize.iso8601DateTime(params["start"]);
if (params["granularity"] !== undefined)
data["Granularity"] = params["granularity"];
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, simSid) {
this._version = _version;
this.simSid = payload.sim_sid;
this.accountSid = payload.account_sid;
this.period = payload.period;
this.commands = payload.commands;
this.data = payload.data;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
simSid: this.simSid,
accountSid: this.accountSid,
period: this.period,
commands: this.commands,
data: this.data,
};
}
[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, this._solution.simSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.UsageRecordPage = UsageRecordPage;

View File

@@ -0,0 +1,234 @@
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";
/**
* How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period.
*/
export type UsageRecordGranularity = "hourly" | "daily" | "all";
/**
* Options to pass to each
*/
export interface UsageRecordListInstanceEachOptions {
/** Only include usage that has occurred on or before this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */
end?: Date;
/** Only include usage that has occurred on or after this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */
start?: Date;
/** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */
granularity?: UsageRecordGranularity;
/** 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 {
/** Only include usage that has occurred on or before this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */
end?: Date;
/** Only include usage that has occurred on or after this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */
start?: Date;
/** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */
granularity?: UsageRecordGranularity;
/** 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 {
/** Only include usage that has occurred on or before this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */
end?: Date;
/** Only include usage that has occurred on or after this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */
start?: Date;
/** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */
granularity?: UsageRecordGranularity;
/** 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;
period: any;
commands: any;
data: any;
}
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 created the AccountUsageRecord resource.
*/
accountSid: string;
/**
* The time period for which usage is reported. Contains `start` and `end` properties that describe the period using GMT date-time values specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
*/
period: any;
/**
* An object that describes the aggregated Commands usage for all SIMs during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/iot/wireless/api/account-usagerecord-resource#commands-usage-object).
*/
commands: any;
/**
* An object that describes the aggregated Data usage for all SIMs over the period. See [Data Usage Object](https://www.twilio.com/docs/iot/wireless/api/account-usagerecord-resource#data-usage-object).
*/
data: any;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
period: any;
commands: any;
data: any;
};
[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 {};

185
node_modules/twilio/lib/rest/wireless/v1/usageRecord.js generated vendored Normal file
View File

@@ -0,0 +1,185 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Wireless
* 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["end"] !== undefined)
data["End"] = serialize.iso8601DateTime(params["end"]);
if (params["start"] !== undefined)
data["Start"] = serialize.iso8601DateTime(params["start"]);
if (params["granularity"] !== undefined)
data["Granularity"] = params["granularity"];
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["end"] !== undefined)
data["End"] = serialize.iso8601DateTime(params["end"]);
if (params["start"] !== undefined)
data["Start"] = serialize.iso8601DateTime(params["start"]);
if (params["granularity"] !== undefined)
data["Granularity"] = params["granularity"];
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.period = payload.period;
this.commands = payload.commands;
this.data = payload.data;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
period: this.period,
commands: this.commands,
data: this.data,
};
}
[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;