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

45
node_modules/twilio/lib/rest/accounts/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,45 @@
import AccountsBase from "../AccountsBase";
import Version from "../../base/Version";
import { AuthTokenPromotionListInstance } from "./v1/authTokenPromotion";
import { BulkConsentsListInstance } from "./v1/bulkConsents";
import { BulkContactsListInstance } from "./v1/bulkContacts";
import { CredentialListInstance } from "./v1/credential";
import { MessagingGeopermissionsListInstance } from "./v1/messagingGeopermissions";
import { SafelistListInstance } from "./v1/safelist";
import { SecondaryAuthTokenListInstance } from "./v1/secondaryAuthToken";
export default class V1 extends Version {
/**
* Initialize the V1 version of Accounts
*
* @param domain - The Twilio (Twilio.Accounts) domain
*/
constructor(domain: AccountsBase);
/** authTokenPromotion - { Twilio.Accounts.V1.AuthTokenPromotionListInstance } resource */
protected _authTokenPromotion?: AuthTokenPromotionListInstance;
/** bulkConsents - { Twilio.Accounts.V1.BulkConsentsListInstance } resource */
protected _bulkConsents?: BulkConsentsListInstance;
/** bulkContacts - { Twilio.Accounts.V1.BulkContactsListInstance } resource */
protected _bulkContacts?: BulkContactsListInstance;
/** credentials - { Twilio.Accounts.V1.CredentialListInstance } resource */
protected _credentials?: CredentialListInstance;
/** messagingGeopermissions - { Twilio.Accounts.V1.MessagingGeopermissionsListInstance } resource */
protected _messagingGeopermissions?: MessagingGeopermissionsListInstance;
/** safelist - { Twilio.Accounts.V1.SafelistListInstance } resource */
protected _safelist?: SafelistListInstance;
/** secondaryAuthToken - { Twilio.Accounts.V1.SecondaryAuthTokenListInstance } resource */
protected _secondaryAuthToken?: SecondaryAuthTokenListInstance;
/** Getter for authTokenPromotion resource */
get authTokenPromotion(): AuthTokenPromotionListInstance;
/** Getter for bulkConsents resource */
get bulkConsents(): BulkConsentsListInstance;
/** Getter for bulkContacts resource */
get bulkContacts(): BulkContactsListInstance;
/** Getter for credentials resource */
get credentials(): CredentialListInstance;
/** Getter for messagingGeopermissions resource */
get messagingGeopermissions(): MessagingGeopermissionsListInstance;
/** Getter for safelist resource */
get safelist(): SafelistListInstance;
/** Getter for secondaryAuthToken resource */
get secondaryAuthToken(): SecondaryAuthTokenListInstance;
}

76
node_modules/twilio/lib/rest/accounts/V1.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* 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 authTokenPromotion_1 = require("./v1/authTokenPromotion");
const bulkConsents_1 = require("./v1/bulkConsents");
const bulkContacts_1 = require("./v1/bulkContacts");
const credential_1 = require("./v1/credential");
const messagingGeopermissions_1 = require("./v1/messagingGeopermissions");
const safelist_1 = require("./v1/safelist");
const secondaryAuthToken_1 = require("./v1/secondaryAuthToken");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Accounts
*
* @param domain - The Twilio (Twilio.Accounts) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for authTokenPromotion resource */
get authTokenPromotion() {
this._authTokenPromotion =
this._authTokenPromotion || (0, authTokenPromotion_1.AuthTokenPromotionListInstance)(this);
return this._authTokenPromotion;
}
/** Getter for bulkConsents resource */
get bulkConsents() {
this._bulkConsents = this._bulkConsents || (0, bulkConsents_1.BulkConsentsListInstance)(this);
return this._bulkConsents;
}
/** Getter for bulkContacts resource */
get bulkContacts() {
this._bulkContacts = this._bulkContacts || (0, bulkContacts_1.BulkContactsListInstance)(this);
return this._bulkContacts;
}
/** Getter for credentials resource */
get credentials() {
this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this);
return this._credentials;
}
/** Getter for messagingGeopermissions resource */
get messagingGeopermissions() {
this._messagingGeopermissions =
this._messagingGeopermissions ||
(0, messagingGeopermissions_1.MessagingGeopermissionsListInstance)(this);
return this._messagingGeopermissions;
}
/** Getter for safelist resource */
get safelist() {
this._safelist = this._safelist || (0, safelist_1.SafelistListInstance)(this);
return this._safelist;
}
/** Getter for secondaryAuthToken resource */
get secondaryAuthToken() {
this._secondaryAuthToken =
this._secondaryAuthToken || (0, secondaryAuthToken_1.SecondaryAuthTokenListInstance)(this);
return this._secondaryAuthToken;
}
}
exports.default = V1;

View File

@@ -0,0 +1,122 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export interface AuthTokenPromotionContext {
/**
* Update a AuthTokenPromotionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance
*/
update(callback?: (error: Error | null, item?: AuthTokenPromotionInstance) => any): Promise<AuthTokenPromotionInstance>;
/**
* Update a AuthTokenPromotionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthTokenPromotionInstance>) => any): Promise<ApiResponse<AuthTokenPromotionInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface AuthTokenPromotionContextSolution {
}
export declare class AuthTokenPromotionContextImpl implements AuthTokenPromotionContext {
protected _version: V1;
protected _solution: AuthTokenPromotionContextSolution;
protected _uri: string;
constructor(_version: V1);
update(callback?: (error: Error | null, item?: AuthTokenPromotionInstance) => any): Promise<AuthTokenPromotionInstance>;
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthTokenPromotionInstance>) => any): Promise<ApiResponse<AuthTokenPromotionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): AuthTokenPromotionContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AuthTokenPromotionResource {
account_sid: string;
auth_token: string;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class AuthTokenPromotionInstance {
protected _version: V1;
protected _solution: AuthTokenPromotionContextSolution;
protected _context?: AuthTokenPromotionContext;
constructor(_version: V1, payload: AuthTokenPromotionResource);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for.
*/
accountSid: string;
/**
* The promoted Auth Token that must be used to authenticate future API requests.
*/
authToken: string;
/**
* The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The URI for this resource, relative to `https://accounts.twilio.com`
*/
url: string;
private get _proxy();
/**
* Update a AuthTokenPromotionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance
*/
update(callback?: (error: Error | null, item?: AuthTokenPromotionInstance) => any): Promise<AuthTokenPromotionInstance>;
/**
* Update a AuthTokenPromotionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthTokenPromotionInstance>) => any): Promise<ApiResponse<AuthTokenPromotionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
authToken: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AuthTokenPromotionSolution {
}
export interface AuthTokenPromotionListInstance {
_version: V1;
_solution: AuthTokenPromotionSolution;
_uri: string;
(): AuthTokenPromotionContext;
get(): AuthTokenPromotionContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AuthTokenPromotionListInstance(version: V1): AuthTokenPromotionListInstance;
export {};

View File

@@ -0,0 +1,141 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthTokenPromotionInstance = exports.AuthTokenPromotionContextImpl = void 0;
exports.AuthTokenPromotionListInstance = AuthTokenPromotionListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
class AuthTokenPromotionContextImpl {
constructor(_version) {
this._version = _version;
this._solution = {};
this._uri = `/AuthTokens/Promote`;
}
update(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
headers,
});
operationPromise = operationPromise.then((payload) => new AuthTokenPromotionInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
headers,
})
.then((response) => ({
...response,
body: new AuthTokenPromotionInstance(operationVersion, response.body),
}));
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.AuthTokenPromotionContextImpl = AuthTokenPromotionContextImpl;
class AuthTokenPromotionInstance {
constructor(_version, payload) {
this._version = _version;
this.accountSid = payload.account_sid;
this.authToken = payload.auth_token;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = {};
}
get _proxy() {
this._context =
this._context || new AuthTokenPromotionContextImpl(this._version);
return this._context;
}
/**
* Update a AuthTokenPromotionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance
*/
update(callback) {
return this._proxy.update(callback);
}
/**
* Update a AuthTokenPromotionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance with HTTP metadata
*/
updateWithHttpInfo(callback) {
return this._proxy.updateWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
authToken: this.authToken,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AuthTokenPromotionInstance = AuthTokenPromotionInstance;
function AuthTokenPromotionListInstance(version) {
const instance = (() => instance.get());
instance.get = function get() {
return new AuthTokenPromotionContextImpl(version);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,62 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to create a BulkConsentsInstance
*/
export interface BulkConsentsListInstanceCreateOptions {
/** This is a list of objects that describes a contact\\\'s opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`]; `date_of_consent`, an optional datetime string field in ISO-8601 format that captures the exact date and time when the user gave or revoked consent. If not provided, it will be empty. */
items: Array<any>;
}
export interface BulkConsentsSolution {
}
export interface BulkConsentsListInstance {
_version: V1;
_solution: BulkConsentsSolution;
_uri: string;
/**
* Create a BulkConsentsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BulkConsentsInstance
*/
create(params: BulkConsentsListInstanceCreateOptions, callback?: (error: Error | null, item?: BulkConsentsInstance) => any): Promise<BulkConsentsInstance>;
/**
* Create a BulkConsentsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BulkConsentsInstance with HTTP metadata
*/
createWithHttpInfo(params: BulkConsentsListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<BulkConsentsInstance>) => any): Promise<ApiResponse<BulkConsentsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function BulkConsentsListInstance(version: V1): BulkConsentsListInstance;
interface BulkConsentsResource {
items: any;
}
export declare class BulkConsentsInstance {
protected _version: V1;
constructor(_version: V1, payload: BulkConsentsResource);
/**
* A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty.
*/
items: any;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
items: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,103 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BulkConsentsInstance = void 0;
exports.BulkConsentsListInstance = BulkConsentsListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function BulkConsentsListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Consents/Bulk`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["items"] === null || params["items"] === undefined) {
throw new Error("Required parameter \"params['items']\" missing.");
}
let data = {};
data["Items"] = serialize.map(params["items"], (e) => serialize.object(e));
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new BulkConsentsInstance(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["items"] === null || params["items"] === undefined) {
throw new Error("Required parameter \"params['items']\" missing.");
}
let data = {};
data["Items"] = serialize.map(params["items"], (e) => serialize.object(e));
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new BulkConsentsInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class BulkConsentsInstance {
constructor(_version, payload) {
this._version = _version;
this.items = payload.items;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
items: this.items,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BulkConsentsInstance = BulkConsentsInstance;

View File

@@ -0,0 +1,62 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to create a BulkContactsInstance
*/
export interface BulkContactsListInstanceCreateOptions {
/** A list of objects where each object represents a contact\\\'s details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code. */
items: Array<any>;
}
export interface BulkContactsSolution {
}
export interface BulkContactsListInstance {
_version: V1;
_solution: BulkContactsSolution;
_uri: string;
/**
* Create a BulkContactsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BulkContactsInstance
*/
create(params: BulkContactsListInstanceCreateOptions, callback?: (error: Error | null, item?: BulkContactsInstance) => any): Promise<BulkContactsInstance>;
/**
* Create a BulkContactsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed BulkContactsInstance with HTTP metadata
*/
createWithHttpInfo(params: BulkContactsListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<BulkContactsInstance>) => any): Promise<ApiResponse<BulkContactsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function BulkContactsListInstance(version: V1): BulkContactsListInstance;
interface BulkContactsResource {
items: any;
}
export declare class BulkContactsInstance {
protected _version: V1;
constructor(_version: V1, payload: BulkContactsResource);
/**
* A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty.
*/
items: any;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
items: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,103 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BulkContactsInstance = void 0;
exports.BulkContactsListInstance = BulkContactsListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function BulkContactsListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Contacts/Bulk`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["items"] === null || params["items"] === undefined) {
throw new Error("Required parameter \"params['items']\" missing.");
}
let data = {};
data["Items"] = serialize.map(params["items"], (e) => serialize.object(e));
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new BulkContactsInstance(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["items"] === null || params["items"] === undefined) {
throw new Error("Required parameter \"params['items']\" missing.");
}
let data = {};
data["Items"] = serialize.map(params["items"], (e) => serialize.object(e));
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new BulkContactsInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class BulkContactsInstance {
constructor(_version, payload) {
this._version = _version;
this.items = payload.items;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
items: this.items,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.BulkContactsInstance = BulkContactsInstance;

View File

@@ -0,0 +1,21 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { AwsListInstance } from "./credential/aws";
import { PublicKeyListInstance } from "./credential/publicKey";
export interface CredentialSolution {
}
export interface CredentialListInstance {
_version: V1;
_solution: CredentialSolution;
_uri: string;
_aws?: AwsListInstance;
aws: AwsListInstance;
_publicKey?: PublicKeyListInstance;
publicKey: PublicKeyListInstance;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CredentialListInstance(version: V1): CredentialListInstance;

50
node_modules/twilio/lib/rest/accounts/v1/credential.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CredentialListInstance = CredentialListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const aws_1 = require("./credential/aws");
const publicKey_1 = require("./credential/publicKey");
function CredentialListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Credentials`;
Object.defineProperty(instance, "aws", {
get: function aws() {
if (!instance._aws) {
instance._aws = (0, aws_1.AwsListInstance)(instance._version);
}
return instance._aws;
},
});
Object.defineProperty(instance, "publicKey", {
get: function publicKey() {
if (!instance._publicKey) {
instance._publicKey = (0, publicKey_1.PublicKeyListInstance)(instance._version);
}
return instance._publicKey;
},
});
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,426 @@
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 update a AwsInstance
*/
export interface AwsContextUpdateOptions {
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName?: string;
}
/**
* Options to pass to create a AwsInstance
*/
export interface AwsListInstanceCreateOptions {
/** A string that contains the AWS access credentials in the format `<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>`. For example, `AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY` */
credentials: string;
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName?: string;
/** The SID of the Subaccount that this Credential should be associated with. Must be a valid Subaccount of the account issuing the request. */
accountSid?: string;
}
/**
* Options to pass to each
*/
export interface AwsListInstanceEachOptions {
/** 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: AwsInstance, 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 AwsListInstanceOptions {
/** 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 AwsListInstancePageOptions {
/** 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 AwsContext {
/**
* Remove a AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AwsInstance 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 AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
fetch(callback?: (error: Error | null, item?: AwsInstance) => any): Promise<AwsInstance>;
/**
* Fetch a AwsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AwsInstance>) => any): Promise<ApiResponse<AwsInstance>>;
/**
* Update a AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
update(callback?: (error: Error | null, item?: AwsInstance) => any): Promise<AwsInstance>;
/**
* Update a AwsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
update(params: AwsContextUpdateOptions, callback?: (error: Error | null, item?: AwsInstance) => any): Promise<AwsInstance>;
/**
* Update a AwsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AwsInstance>) => any): Promise<ApiResponse<AwsInstance>>;
/**
* Update a AwsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance with HTTP metadata
*/
updateWithHttpInfo(params: AwsContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<AwsInstance>) => any): Promise<ApiResponse<AwsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface AwsContextSolution {
sid: string;
}
export declare class AwsContextImpl implements AwsContext {
protected _version: V1;
protected _solution: AwsContextSolution;
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?: AwsInstance) => any): Promise<AwsInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AwsInstance>) => any): Promise<ApiResponse<AwsInstance>>;
update(params?: AwsContextUpdateOptions | ((error: Error | null, item?: AwsInstance) => any), callback?: (error: Error | null, item?: AwsInstance) => any): Promise<AwsInstance>;
updateWithHttpInfo(params?: AwsContextUpdateOptions | ((error: Error | null, item?: ApiResponse<AwsInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<AwsInstance>) => any): Promise<ApiResponse<AwsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): AwsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AwsPayload extends TwilioResponsePayload {
credentials: AwsResource[];
}
interface AwsResource {
sid: string;
account_sid: string;
friendly_name: string;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class AwsInstance {
protected _version: V1;
protected _solution: AwsContextSolution;
protected _context?: AwsContext;
constructor(_version: V1, payload: AwsResource, sid?: string);
/**
* The unique string that we created to identify the AWS resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AWS resource.
*/
accountSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The URI for this resource, relative to `https://accounts.twilio.com`
*/
url: string;
private get _proxy();
/**
* Remove a AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AwsInstance 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 AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
fetch(callback?: (error: Error | null, item?: AwsInstance) => any): Promise<AwsInstance>;
/**
* Fetch a AwsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AwsInstance>) => any): Promise<ApiResponse<AwsInstance>>;
/**
* Update a AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
update(callback?: (error: Error | null, item?: AwsInstance) => any): Promise<AwsInstance>;
/**
* Update a AwsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
update(params: AwsContextUpdateOptions, callback?: (error: Error | null, item?: AwsInstance) => any): Promise<AwsInstance>;
/**
* Update a AwsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AwsInstance>) => any): Promise<ApiResponse<AwsInstance>>;
/**
* Update a AwsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance with HTTP metadata
*/
updateWithHttpInfo(params: AwsContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<AwsInstance>) => any): Promise<ApiResponse<AwsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
friendlyName: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AwsSolution {
}
export interface AwsListInstance {
_version: V1;
_solution: AwsSolution;
_uri: string;
(sid: string): AwsContext;
get(sid: string): AwsContext;
/**
* Create a AwsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
create(params: AwsListInstanceCreateOptions, callback?: (error: Error | null, item?: AwsInstance) => any): Promise<AwsInstance>;
/**
* Create a AwsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance with HTTP metadata
*/
createWithHttpInfo(params: AwsListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<AwsInstance>) => any): Promise<ApiResponse<AwsInstance>>;
/**
* Streams AwsInstance 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 { AwsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: AwsInstance, done: (err?: Error) => void) => void): void;
each(params: AwsListInstanceEachOptions, callback?: (item: AwsInstance, done: (err?: Error) => void) => void): void;
/**
* Streams AwsInstance 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 { AwsListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: AwsInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: AwsListInstanceEachOptions, callback?: (item: AwsInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of AwsInstance 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: AwsPage) => any): Promise<AwsPage>;
/**
* Retrieve a single target page of AwsInstance 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<AwsPage>) => any): Promise<ApiResponse<AwsPage>>;
/**
* Lists AwsInstance 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 { AwsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: AwsInstance[]) => any): Promise<AwsInstance[]>;
list(params: AwsListInstanceOptions, callback?: (error: Error | null, items: AwsInstance[]) => any): Promise<AwsInstance[]>;
/**
* Lists AwsInstance 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 { AwsListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AwsInstance[]>) => any): Promise<ApiResponse<AwsInstance[]>>;
listWithHttpInfo(params: AwsListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AwsInstance[]>) => any): Promise<ApiResponse<AwsInstance[]>>;
/**
* Retrieve a single page of AwsInstance 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 { AwsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: AwsPage) => any): Promise<AwsPage>;
page(params: AwsListInstancePageOptions, callback?: (error: Error | null, items: AwsPage) => any): Promise<AwsPage>;
/**
* Retrieve a single page of AwsInstance 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 { AwsListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AwsPage>) => any): Promise<ApiResponse<AwsPage>>;
pageWithHttpInfo(params: AwsListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AwsPage>) => any): Promise<ApiResponse<AwsPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AwsListInstance(version: V1): AwsListInstance;
export declare class AwsPage extends Page<V1, AwsPayload, AwsResource, AwsInstance> {
/**
* Initialize the AwsPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: AwsSolution);
/**
* Build an instance of AwsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: AwsResource): AwsInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,426 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* 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.AwsPage = exports.AwsInstance = exports.AwsContextImpl = void 0;
exports.AwsListInstance = AwsListInstance;
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 AwsContextImpl {
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 = `/Credentials/AWS/${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 AwsInstance(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 AwsInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
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 AwsInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
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 AwsInstance(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.AwsContextImpl = AwsContextImpl;
class AwsInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
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 AwsContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a AwsInstance 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 AwsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a AwsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AwsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AwsInstance = AwsInstance;
function AwsListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new AwsContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Credentials/AWS`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["credentials"] === null || params["credentials"] === undefined) {
throw new Error("Required parameter \"params['credentials']\" missing.");
}
let data = {};
data["Credentials"] = params["credentials"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["accountSid"] !== undefined)
data["AccountSid"] = params["accountSid"];
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 AwsInstance(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["credentials"] === null || params["credentials"] === undefined) {
throw new Error("Required parameter \"params['credentials']\" missing.");
}
let data = {};
data["Credentials"] = params["credentials"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["accountSid"] !== undefined)
data["AccountSid"] = params["accountSid"];
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 AwsInstance(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 AwsPage(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 AwsPage(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 AwsPage(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 AwsPage(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 AwsPage extends Page_1.default {
/**
* Initialize the AwsPage
*
* @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 AwsInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new AwsInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AwsPage = AwsPage;

View File

@@ -0,0 +1,426 @@
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 update a PublicKeyInstance
*/
export interface PublicKeyContextUpdateOptions {
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName?: string;
}
/**
* Options to pass to create a PublicKeyInstance
*/
export interface PublicKeyListInstanceCreateOptions {
/** A URL encoded representation of the public key. For example, `-----BEGIN PUBLIC KEY-----MIIBIjANB.pa9xQIDAQAB-----END PUBLIC KEY-----` */
publicKey: string;
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
friendlyName?: string;
/** The SID of the Subaccount that this Credential should be associated with. Must be a valid Subaccount of the account issuing the request */
accountSid?: string;
}
/**
* Options to pass to each
*/
export interface PublicKeyListInstanceEachOptions {
/** 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: PublicKeyInstance, 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 PublicKeyListInstanceOptions {
/** 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 PublicKeyListInstancePageOptions {
/** 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 PublicKeyContext {
/**
* Remove a PublicKeyInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a PublicKeyInstance 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 PublicKeyInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance
*/
fetch(callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<PublicKeyInstance>;
/**
* Fetch a PublicKeyInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any): Promise<ApiResponse<PublicKeyInstance>>;
/**
* Update a PublicKeyInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance
*/
update(callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<PublicKeyInstance>;
/**
* Update a PublicKeyInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance
*/
update(params: PublicKeyContextUpdateOptions, callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<PublicKeyInstance>;
/**
* Update a PublicKeyInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any): Promise<ApiResponse<PublicKeyInstance>>;
/**
* Update a PublicKeyInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance with HTTP metadata
*/
updateWithHttpInfo(params: PublicKeyContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any): Promise<ApiResponse<PublicKeyInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface PublicKeyContextSolution {
sid: string;
}
export declare class PublicKeyContextImpl implements PublicKeyContext {
protected _version: V1;
protected _solution: PublicKeyContextSolution;
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?: PublicKeyInstance) => any): Promise<PublicKeyInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any): Promise<ApiResponse<PublicKeyInstance>>;
update(params?: PublicKeyContextUpdateOptions | ((error: Error | null, item?: PublicKeyInstance) => any), callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<PublicKeyInstance>;
updateWithHttpInfo(params?: PublicKeyContextUpdateOptions | ((error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any): Promise<ApiResponse<PublicKeyInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): PublicKeyContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface PublicKeyPayload extends TwilioResponsePayload {
credentials: PublicKeyResource[];
}
interface PublicKeyResource {
sid: string;
account_sid: string;
friendly_name: string;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class PublicKeyInstance {
protected _version: V1;
protected _solution: PublicKeyContextSolution;
protected _context?: PublicKeyContext;
constructor(_version: V1, payload: PublicKeyResource, sid?: string);
/**
* The unique string that that we created to identify the PublicKey resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential that the PublicKey resource belongs to.
*/
accountSid: string;
/**
* The string that you assigned to describe the resource.
*/
friendlyName: string;
/**
* The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
*/
dateUpdated: Date;
/**
* The URI for this resource, relative to `https://accounts.twilio.com`
*/
url: string;
private get _proxy();
/**
* Remove a PublicKeyInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a PublicKeyInstance 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 PublicKeyInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance
*/
fetch(callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<PublicKeyInstance>;
/**
* Fetch a PublicKeyInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any): Promise<ApiResponse<PublicKeyInstance>>;
/**
* Update a PublicKeyInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance
*/
update(callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<PublicKeyInstance>;
/**
* Update a PublicKeyInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance
*/
update(params: PublicKeyContextUpdateOptions, callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<PublicKeyInstance>;
/**
* Update a PublicKeyInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any): Promise<ApiResponse<PublicKeyInstance>>;
/**
* Update a PublicKeyInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance with HTTP metadata
*/
updateWithHttpInfo(params: PublicKeyContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any): Promise<ApiResponse<PublicKeyInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
friendlyName: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface PublicKeySolution {
}
export interface PublicKeyListInstance {
_version: V1;
_solution: PublicKeySolution;
_uri: string;
(sid: string): PublicKeyContext;
get(sid: string): PublicKeyContext;
/**
* Create a PublicKeyInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance
*/
create(params: PublicKeyListInstanceCreateOptions, callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<PublicKeyInstance>;
/**
* Create a PublicKeyInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance with HTTP metadata
*/
createWithHttpInfo(params: PublicKeyListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<PublicKeyInstance>) => any): Promise<ApiResponse<PublicKeyInstance>>;
/**
* Streams PublicKeyInstance 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 { PublicKeyListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: PublicKeyInstance, done: (err?: Error) => void) => void): void;
each(params: PublicKeyListInstanceEachOptions, callback?: (item: PublicKeyInstance, done: (err?: Error) => void) => void): void;
/**
* Streams PublicKeyInstance 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 { PublicKeyListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: PublicKeyInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: PublicKeyListInstanceEachOptions, callback?: (item: PublicKeyInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of PublicKeyInstance 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: PublicKeyPage) => any): Promise<PublicKeyPage>;
/**
* Retrieve a single target page of PublicKeyInstance 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<PublicKeyPage>) => any): Promise<ApiResponse<PublicKeyPage>>;
/**
* Lists PublicKeyInstance 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 { PublicKeyListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: PublicKeyInstance[]) => any): Promise<PublicKeyInstance[]>;
list(params: PublicKeyListInstanceOptions, callback?: (error: Error | null, items: PublicKeyInstance[]) => any): Promise<PublicKeyInstance[]>;
/**
* Lists PublicKeyInstance 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 { PublicKeyListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PublicKeyInstance[]>) => any): Promise<ApiResponse<PublicKeyInstance[]>>;
listWithHttpInfo(params: PublicKeyListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<PublicKeyInstance[]>) => any): Promise<ApiResponse<PublicKeyInstance[]>>;
/**
* Retrieve a single page of PublicKeyInstance 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 { PublicKeyListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: PublicKeyPage) => any): Promise<PublicKeyPage>;
page(params: PublicKeyListInstancePageOptions, callback?: (error: Error | null, items: PublicKeyPage) => any): Promise<PublicKeyPage>;
/**
* Retrieve a single page of PublicKeyInstance 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 { PublicKeyListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PublicKeyPage>) => any): Promise<ApiResponse<PublicKeyPage>>;
pageWithHttpInfo(params: PublicKeyListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<PublicKeyPage>) => any): Promise<ApiResponse<PublicKeyPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function PublicKeyListInstance(version: V1): PublicKeyListInstance;
export declare class PublicKeyPage extends Page<V1, PublicKeyPayload, PublicKeyResource, PublicKeyInstance> {
/**
* Initialize the PublicKeyPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: PublicKeySolution);
/**
* Build an instance of PublicKeyInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: PublicKeyResource): PublicKeyInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,427 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* 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.PublicKeyPage = exports.PublicKeyInstance = exports.PublicKeyContextImpl = void 0;
exports.PublicKeyListInstance = PublicKeyListInstance;
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 PublicKeyContextImpl {
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 = `/Credentials/PublicKeys/${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 PublicKeyInstance(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 PublicKeyInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
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 PublicKeyInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
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 PublicKeyInstance(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.PublicKeyContextImpl = PublicKeyContextImpl;
class PublicKeyInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
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 PublicKeyContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a PublicKeyInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a PublicKeyInstance 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 PublicKeyInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a PublicKeyInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PublicKeyInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PublicKeyInstance = PublicKeyInstance;
function PublicKeyListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new PublicKeyContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Credentials/PublicKeys`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["publicKey"] === null || params["publicKey"] === undefined) {
throw new Error("Required parameter \"params['publicKey']\" missing.");
}
let data = {};
data["PublicKey"] = params["publicKey"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["accountSid"] !== undefined)
data["AccountSid"] = params["accountSid"];
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 PublicKeyInstance(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["publicKey"] === null || params["publicKey"] === undefined) {
throw new Error("Required parameter \"params['publicKey']\" missing.");
}
let data = {};
data["PublicKey"] = params["publicKey"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["accountSid"] !== undefined)
data["AccountSid"] = params["accountSid"];
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 PublicKeyInstance(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 PublicKeyPage(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 PublicKeyPage(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 PublicKeyPage(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 PublicKeyPage(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 PublicKeyPage extends Page_1.default {
/**
* Initialize the PublicKeyPage
*
* @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 PublicKeyInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new PublicKeyInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PublicKeyPage = PublicKeyPage;

View File

@@ -0,0 +1,103 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to fetch a MessagingGeopermissionsInstance
*/
export interface MessagingGeopermissionsListInstanceFetchOptions {
/** The country code to filter the geo permissions. If provided, only the geo permission for the specified country will be returned. */
countryCode?: string;
}
/**
* Options to pass to update a MessagingGeopermissionsInstance
*/
export interface MessagingGeopermissionsListInstanceUpdateOptions {
/** A list of objects where each object represents the Geo Permission to be updated. Each object contains the following fields: `country_code`, unique code for each country of Geo Permission; `type`, permission type of the Geo Permission i.e. country; `enabled`, configure true for enabling the Geo Permission, false for disabling the Geo Permission. */
permissions: Array<any>;
}
export interface MessagingGeopermissionsSolution {
}
export interface MessagingGeopermissionsListInstance {
_version: V1;
_solution: MessagingGeopermissionsSolution;
_uri: string;
/**
* Fetch a MessagingGeopermissionsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MessagingGeopermissionsInstance
*/
fetch(callback?: (error: Error | null, item?: MessagingGeopermissionsInstance) => any): Promise<MessagingGeopermissionsInstance>;
/**
* Fetch a MessagingGeopermissionsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MessagingGeopermissionsInstance
*/
fetch(params: MessagingGeopermissionsListInstanceFetchOptions, callback?: (error: Error | null, item?: MessagingGeopermissionsInstance) => any): Promise<MessagingGeopermissionsInstance>;
/**
* Fetch a MessagingGeopermissionsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MessagingGeopermissionsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<MessagingGeopermissionsInstance>) => any): Promise<ApiResponse<MessagingGeopermissionsInstance>>;
/**
* Fetch a MessagingGeopermissionsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MessagingGeopermissionsInstance with HTTP metadata
*/
fetchWithHttpInfo(params: MessagingGeopermissionsListInstanceFetchOptions, callback?: (error: Error | null, item?: ApiResponse<MessagingGeopermissionsInstance>) => any): Promise<ApiResponse<MessagingGeopermissionsInstance>>;
/**
* Update a MessagingGeopermissionsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MessagingGeopermissionsInstance
*/
update(params: MessagingGeopermissionsListInstanceUpdateOptions, callback?: (error: Error | null, item?: MessagingGeopermissionsInstance) => any): Promise<MessagingGeopermissionsInstance>;
/**
* Update a MessagingGeopermissionsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MessagingGeopermissionsInstance with HTTP metadata
*/
updateWithHttpInfo(params: MessagingGeopermissionsListInstanceUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<MessagingGeopermissionsInstance>) => any): Promise<ApiResponse<MessagingGeopermissionsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function MessagingGeopermissionsListInstance(version: V1): MessagingGeopermissionsListInstance;
interface MessagingGeopermissionsResource {
permissions: any;
}
export declare class MessagingGeopermissionsInstance {
protected _version: V1;
constructor(_version: V1, payload: MessagingGeopermissionsResource);
/**
* A list of objects where each object represents the result of processing a messaging Geo Permission. Each object contains the following fields: `country_code`, the country code of the country for which the permission was updated; `type`, the type of the permission i.e. country; `enabled`, true if the permission is enabled else false; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty.
*/
permissions: any;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
permissions: any;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,155 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessagingGeopermissionsInstance = void 0;
exports.MessagingGeopermissionsListInstance = MessagingGeopermissionsListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function MessagingGeopermissionsListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Messaging/GeoPermissions`;
instance.fetch = function fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["countryCode"] !== undefined)
data["CountryCode"] = params["countryCode"];
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new MessagingGeopermissionsInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.fetchWithHttpInfo = function fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["countryCode"] !== undefined)
data["CountryCode"] = params["countryCode"];
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
params: data,
headers,
})
.then((response) => ({
...response,
body: new MessagingGeopermissionsInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.update = function update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["permissions"] === null || params["permissions"] === undefined) {
throw new Error("Required parameter \"params['permissions']\" missing.");
}
let data = {};
data["Permissions"] = serialize.map(params["permissions"], (e) => serialize.object(e));
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "patch",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new MessagingGeopermissionsInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.updateWithHttpInfo = function updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["permissions"] === null || params["permissions"] === undefined) {
throw new Error("Required parameter \"params['permissions']\" missing.");
}
let data = {};
data["Permissions"] = serialize.map(params["permissions"], (e) => serialize.object(e));
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "patch",
data,
headers,
})
.then((response) => ({
...response,
body: new MessagingGeopermissionsInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class MessagingGeopermissionsInstance {
constructor(_version, payload) {
this._version = _version;
this.permissions = payload.permissions;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
permissions: this.permissions,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.MessagingGeopermissionsInstance = MessagingGeopermissionsInstance;

150
node_modules/twilio/lib/rest/accounts/v1/safelist.d.ts generated vendored Normal file
View File

@@ -0,0 +1,150 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to create a SafelistInstance
*/
export interface SafelistListInstanceCreateOptions {
/** The phone number or phone number 1k prefix to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). */
phoneNumber: string;
}
/**
* Options to pass to remove a SafelistInstance
*/
export interface SafelistListInstanceRemoveOptions {
/** The phone number or phone number 1k prefix to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). */
phoneNumber?: string;
}
/**
* Options to pass to fetch a SafelistInstance
*/
export interface SafelistListInstanceFetchOptions {
/** The phone number or phone number 1k prefix to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). */
phoneNumber?: string;
}
export interface SafelistSolution {
}
export interface SafelistListInstance {
_version: V1;
_solution: SafelistSolution;
_uri: string;
/**
* Create a SafelistInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SafelistInstance
*/
create(params: SafelistListInstanceCreateOptions, callback?: (error: Error | null, item?: SafelistInstance) => any): Promise<SafelistInstance>;
/**
* Create a SafelistInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SafelistInstance with HTTP metadata
*/
createWithHttpInfo(params: SafelistListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<SafelistInstance>) => any): Promise<ApiResponse<SafelistInstance>>;
/**
* Remove a SafelistInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a SafelistInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SafelistInstance
*/
remove(params: SafelistListInstanceRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a SafelistInstance 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>>;
/**
* Remove a SafelistInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SafelistInstance with HTTP metadata
*/
removeWithHttpInfo(params: SafelistListInstanceRemoveOptions, callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a SafelistInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SafelistInstance
*/
fetch(callback?: (error: Error | null, item?: SafelistInstance) => any): Promise<SafelistInstance>;
/**
* Fetch a SafelistInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SafelistInstance
*/
fetch(params: SafelistListInstanceFetchOptions, callback?: (error: Error | null, item?: SafelistInstance) => any): Promise<SafelistInstance>;
/**
* Fetch a SafelistInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SafelistInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SafelistInstance>) => any): Promise<ApiResponse<SafelistInstance>>;
/**
* Fetch a SafelistInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SafelistInstance with HTTP metadata
*/
fetchWithHttpInfo(params: SafelistListInstanceFetchOptions, callback?: (error: Error | null, item?: ApiResponse<SafelistInstance>) => any): Promise<ApiResponse<SafelistInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SafelistListInstance(version: V1): SafelistListInstance;
interface SafelistResource {
sid: string;
phone_number: string;
}
export declare class SafelistInstance {
protected _version: V1;
constructor(_version: V1, payload: SafelistResource);
/**
* The unique string that we created to identify the SafeList resource.
*/
sid: string;
/**
* The phone number or phone number 1k prefix in SafeList.
*/
phoneNumber: string;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
phoneNumber: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

206
node_modules/twilio/lib/rest/accounts/v1/safelist.js generated vendored Normal file
View File

@@ -0,0 +1,206 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.SafelistInstance = void 0;
exports.SafelistListInstance = SafelistListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function SafelistListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/SafeList/Numbers`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["phoneNumber"] === null || params["phoneNumber"] === undefined) {
throw new Error("Required parameter \"params['phoneNumber']\" missing.");
}
let data = {};
data["PhoneNumber"] = params["phoneNumber"];
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 SafelistInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["phoneNumber"] === null || params["phoneNumber"] === undefined) {
throw new Error("Required parameter \"params['phoneNumber']\" missing.");
}
let data = {};
data["PhoneNumber"] = params["phoneNumber"];
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 SafelistInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.remove = function remove(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["phoneNumber"] !== undefined)
data["PhoneNumber"] = params["phoneNumber"];
const headers = {};
let operationVersion = version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
params: data,
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.removeWithHttpInfo = function removeWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["phoneNumber"] !== undefined)
data["PhoneNumber"] = params["phoneNumber"];
const headers = {};
let operationVersion = version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({
uri: instance._uri,
method: "delete",
params: data,
headers,
})
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.fetch = function fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["phoneNumber"] !== undefined)
data["PhoneNumber"] = params["phoneNumber"];
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new SafelistInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.fetchWithHttpInfo = function fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["phoneNumber"] !== undefined)
data["PhoneNumber"] = params["phoneNumber"];
const headers = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
params: data,
headers,
})
.then((response) => ({
...response,
body: new SafelistInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class SafelistInstance {
constructor(_version, payload) {
this._version = _version;
this.sid = payload.sid;
this.phoneNumber = payload.phone_number;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
phoneNumber: this.phoneNumber,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SafelistInstance = SafelistInstance;

View File

@@ -0,0 +1,156 @@
import { inspect, InspectOptions } from "util";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export interface SecondaryAuthTokenContext {
/**
* Create a SecondaryAuthTokenInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SecondaryAuthTokenInstance
*/
create(callback?: (error: Error | null, item?: SecondaryAuthTokenInstance) => any): Promise<SecondaryAuthTokenInstance>;
/**
* Create a SecondaryAuthTokenInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SecondaryAuthTokenInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SecondaryAuthTokenInstance>) => any): Promise<ApiResponse<SecondaryAuthTokenInstance>>;
/**
* Remove a SecondaryAuthTokenInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a SecondaryAuthTokenInstance 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>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface SecondaryAuthTokenContextSolution {
}
export declare class SecondaryAuthTokenContextImpl implements SecondaryAuthTokenContext {
protected _version: V1;
protected _solution: SecondaryAuthTokenContextSolution;
protected _uri: string;
constructor(_version: V1);
create(callback?: (error: Error | null, item?: SecondaryAuthTokenInstance) => any): Promise<SecondaryAuthTokenInstance>;
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SecondaryAuthTokenInstance>) => any): Promise<ApiResponse<SecondaryAuthTokenInstance>>;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): SecondaryAuthTokenContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface SecondaryAuthTokenResource {
account_sid: string;
date_created: Date;
date_updated: Date;
secondary_auth_token: string;
url: string;
}
export declare class SecondaryAuthTokenInstance {
protected _version: V1;
protected _solution: SecondaryAuthTokenContextSolution;
protected _context?: SecondaryAuthTokenContext;
constructor(_version: V1, payload: SecondaryAuthTokenResource);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for.
*/
accountSid: string;
/**
* The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in UTC when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The generated secondary Auth Token that can be used to authenticate future API requests.
*/
secondaryAuthToken: string;
/**
* The URI for this resource, relative to `https://accounts.twilio.com`
*/
url: string;
private get _proxy();
/**
* Create a SecondaryAuthTokenInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SecondaryAuthTokenInstance
*/
create(callback?: (error: Error | null, item?: SecondaryAuthTokenInstance) => any): Promise<SecondaryAuthTokenInstance>;
/**
* Create a SecondaryAuthTokenInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SecondaryAuthTokenInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SecondaryAuthTokenInstance>) => any): Promise<ApiResponse<SecondaryAuthTokenInstance>>;
/**
* Remove a SecondaryAuthTokenInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a SecondaryAuthTokenInstance 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>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
dateCreated: Date;
dateUpdated: Date;
secondaryAuthToken: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface SecondaryAuthTokenSolution {
}
export interface SecondaryAuthTokenListInstance {
_version: V1;
_solution: SecondaryAuthTokenSolution;
_uri: string;
(): SecondaryAuthTokenContext;
get(): SecondaryAuthTokenContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SecondaryAuthTokenListInstance(version: V1): SecondaryAuthTokenListInstance;
export {};

View File

@@ -0,0 +1,186 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.SecondaryAuthTokenInstance = exports.SecondaryAuthTokenContextImpl = void 0;
exports.SecondaryAuthTokenListInstance = SecondaryAuthTokenListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
class SecondaryAuthTokenContextImpl {
constructor(_version) {
this._version = _version;
this._solution = {};
this._uri = `/AuthTokens/Secondary`;
}
create(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
headers,
});
operationPromise = operationPromise.then((payload) => new SecondaryAuthTokenInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
createWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
headers,
})
.then((response) => ({
...response,
body: new SecondaryAuthTokenInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* 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.SecondaryAuthTokenContextImpl = SecondaryAuthTokenContextImpl;
class SecondaryAuthTokenInstance {
constructor(_version, payload) {
this._version = _version;
this.accountSid = payload.account_sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.secondaryAuthToken = payload.secondary_auth_token;
this.url = payload.url;
this._solution = {};
}
get _proxy() {
this._context =
this._context || new SecondaryAuthTokenContextImpl(this._version);
return this._context;
}
/**
* Create a SecondaryAuthTokenInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SecondaryAuthTokenInstance
*/
create(callback) {
return this._proxy.create(callback);
}
/**
* Create a SecondaryAuthTokenInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SecondaryAuthTokenInstance with HTTP metadata
*/
createWithHttpInfo(callback) {
return this._proxy.createWithHttpInfo(callback);
}
/**
* Remove a SecondaryAuthTokenInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a SecondaryAuthTokenInstance 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);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
secondaryAuthToken: this.secondaryAuthToken,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SecondaryAuthTokenInstance = SecondaryAuthTokenInstance;
function SecondaryAuthTokenListInstance(version) {
const instance = (() => instance.get());
instance.get = function get() {
return new SecondaryAuthTokenContextImpl(version);
};
instance._version = version;
instance._solution = {};
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}